wchar[] and wchar*

Kagamin spam at here.lot
Sat Apr 11 02:22:10 PDT 2009


novice2 Wrote:

> http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx
> 
> citate:
> pszPath
>     [out] A pointer to a null-terminated string of length MAX_PATH which will receive the path.
> 
> How i can determine the length of returned path string?
> I know only one way - look for 0, because it is 0-terminated

This happens in your code only *after* function call, before function call pszPath may be not initialized. You don't have to create that buffer by transforming some meaningful string to null terminated string. See example on that page. It's a out buffer initially filled with garbage. So you don't need toStringz to create it. It's meaningless.

> For example all registry functions...
> RegCreateKeyW(IN HKEY hKey, IN LPCWSTR lpSubKey,...

this is readonly string. You can make it by simply appending "\0".

> in VC 7 folder in PlatformSDK\Include i found
> 24 *.h files contain "IN LPWSTR"
> 36 *.h files contain "OUT LPWSTR"
> we shoiuld multiply this by function count in one file...

Can you mention at least one of them?


More information about the Digitalmars-d-learn mailing list