2021年3月31日星期三

What is the data type STR in winapi?

I'm reading a windows programming book and this is written at 18p.

STR data types are string data types, with storage already allocated. This data type is less common than the LPSTR. STR data types are used when the string is supposed to be treated as an immediate array, and not as a simple character pointer.

LPSTR stands for "Long Pointer to a STR", and is essentially defined as such: #define STR * LPSTR;

(I think second citation has a typo, the author might intend typedef STR * LPSTR; by #define STR * LPSTR;.)

There is no explanation about what is the STR and how it is defined. This msdn page also doesn't have a definition of it. And definition of the LPSTR is different from the book: typedef CHAR *LPSTR;

I think the book says STR is an array of character, and microsoft says STR is the same as CHAR which is defined by typedef char CHAR; How should I think about it?

https://stackoverflow.com/questions/66897275/what-is-the-data-type-str-in-winapi April 01, 2021 at 09:23AM

没有评论:

发表评论