INF: Guide to Programming Get Printer Information Code Wrong

ID Number: Q68807

3.00

WINDOWS

docerr

Summary:

The sample code in section 12.2 of the "Microsoft Windows Software

Development Kit Guide to Programming" is incorrect. On page 12-3, the

code by bullet 1 that reads

GetProfileString("windows",

"device",

pPrintInfo,

(LPSTR) NULL, 80);

must be changed to read:

GetProfileString("windows",

"device",

"",

pPrintInfo, 80);

More Information:

The fourth parameter to GetProfileString() specifies a buffer to

receive the result of the GetProfileString() operation. In the sample

above, this value should be pPrintInfo, not NULL.

The third parameter to GetProfileString() is the value to return if

the specified key does not exist in the initialization file. This

value must not be the NULL pointer. However, a pointer to an empty

string ("") is perfectly acceptable and will return an empty string if

the specified key does not exist.

Additional reference words: 3.00