WSTRING

Forum for discussion about the documentation project.
Post Reply
noop
Posts: 130
Joined: Sep 18, 2006 10:29

WSTRING

Post by noop »

Hi,

http://www.freebasic.net/wiki/wikka.php ... yPgWstring
The end of the string is marked by the character 0, so that character must never be part of a Wstring or the content will be truncated.
From this it wasn't clear to me that in fact the character 0 is part of the Wstring and one has to use Wstring*(cnt+1) if the
string to be stored has length cnt.

It would be nice to find this hint in the documentation.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: WSTRING

Post by caseih »

I wonder why the FB developers didn't provide a dynamic WString facility, like String. Then they could have had a wzstring type that behaved just like zstring, but with unicode, requiring the extra byte, and fixed allocation. Seems a bit confusing at first blush, since WString is likely to be more used than String in future years.
PaulSquires
Posts: 1002
Joined: Jul 14, 2005 23:41

Re: WSTRING

Post by PaulSquires »

A dynamic WSTRING string type is on the top of my wish list as well. Would make COM programming in Windows much easier.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: WSTRING

Post by caseih »

How so? I always thought the Windows API used pointers to fixed-length strings for everything.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: WSTRING

Post by fxm »

KeyPgWstring ⇒ FxMwikki [Clarification]
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: WSTRING

Post by marcov »

PaulSquires wrote:A dynamic WSTRING string type is on the top of my wish list as well. Would make COM programming in Windows much easier.
A two byte string type is not automatically a COM BSTR. Heavy use of COM BSTRs is slowing because it goes via the COM memory manager, e.g. Delphi has both a COM and non COM WCHAR based string typed
noop
Posts: 130
Joined: Sep 18, 2006 10:29

Re: WSTRING

Post by noop »

fxm wrote:KeyPgWstring ⇒ FxMwikki [Clarification]
Thank you fxm!
Post Reply