Re: command_line() help
- Posted by Kat <gertie at PELL.NET> Jul 16, 2001
- 417 views
On 16 Jul 2001, at 19:00, euman at bellsouth.net wrote: > > I also thought that unicode was for non-american > text. I realise there is more to this than just that. > Would you care to explain? The Chinese and some others were told to forget using thousands of chars because 16bits wouldn't hold them. Then came 32bit unicode, and because of the way it was implemented, it won't hold them all either. Rather rude of the US designers to tell people they can't spell their names on the puter properly, in my opinion. Kat > Euman > euman at bellsouth.net > > > ----- Original Message ----- > From: "Derek Parnell" <ddparnell at bigpond.com> > To: "EUforum" <EUforum at topica.com> > Sent: Monday, July 16, 2001 16:04 > Subject: Re: command_line() help > > > > > > > > ----- Original Message ----- > > From: <euman at bellsouth.net> > > To: "EUforum" <EUforum at topica.com> > > Sent: Tuesday, July 17, 2001 4:37 AM > > Subject: Re: command_line() help > > > > > > > > > > I was under the assumption that lpzstr > > > was a 0-terminated string. > > > > An LPZSTR is a Long Pointer to a Zero-terminated String. > > That is, it contains a 32-bit address of the first byte in a #00 terminated > > array of bytes. > > > > > would someone explain what the "lpt" is? > > > > > > An LPTSTR is a Long Pointer to a Zero-terminated wide-character String. > > That is, it contains a 32-bit address of the first unsigned 16-bit number in > > a > > #0000 terminated array of unsigned 16-bit numbers. > > > > The definition here comes from the Windows SDK. > > > > typedef unsigned short WCHAR; // wc, 16-bit UNICODE character > > typedef WCHAR *LPWSTR; > > typedef LPWSTR LPTSTR; > > > > > and why is there a difference in the name? > > > > LPZSTR points to a set of bytes, and LPTSTR points to a set of 16-bit > > numbers. > > > > LPTSTR is used for unicode characters. When using the UTF-8 encoding scheme, > > the ASCII character set maps into the unicode characters set with the same > > bit > > patterns. Thus, you can use LPTSTR or LPZSTR if you are only dealing with > > ASCII characters, but you must use LPTSTR is you also have other unicode > > characters in the same string. > > > > If you read further into the SDK documentation on GetCommandLine() there is > > this statement: > > > > "The reason that main() and WinMain() cannot return Unicode strings is that > > argc, argv, and lpCmdLine use the LPSTR data type for parameters, not the > > LPTSTR data type. The GetCommandLine function can be used to access Unicode > > strings, because it uses the LPTSTR data type. " > > > > ----- > > cheers, > > Derek > > > > > > > > > > > > > >