PDA

View Full Version : New standard string data types.



VirtualAce
08-27-2006, 04:00 PM
I've been messing around with strings a lot for various game programming tasks and have realized using the standard C library for strings is a nightmare.

Are there any plans to port the C standard string functions over to newer string types like Unicode instead of just using char?

Converting between them has become a real pain. And then you have the ATL/MFC conversion macros which look like alphabet soup.

anonytmouse
08-27-2006, 10:14 PM
Are you talking about <wchar.h> (http://www.dinkumware.com/manuals/?manual=compleat&page=wchar.html), or something else?

VirtualAce
08-28-2006, 12:24 AM
Yes wchar.h. Is this part of the standard now b/c most of the CRT still requires a char pointer as a parameter to the string functions.

anonytmouse
08-28-2006, 06:16 AM
According to that page, it has been part of the standard since 95. The functions were available on Windows 95.

There is still no standard support for opening files with unicode file names but Windows NT provides the _wfopen function. In fact, MSVC provides wide character versions of most functions that take a string, but many of these are not standard.

DavidP
08-28-2006, 06:57 AM
echo everything that everybody else has said. wchar.h works great.

There is also something else I wanted to suggest, depending on your needs and what you have available. C++ (not C) has a standard string class (i think it is called string.h...but i would have to double check).

If you are just using C, then you couldnt make use of it, but even if you are using C++, the standard string class might be a little too much for your needs. It is quite a nice class though.