Using WriteFile with UNICODE

Started by
2 comments, last by wazoo69 19 years, 3 months ago
Hey everyone, Silly question which I can't seem to find a straight answer for via Google.. Just trying to update my objects to work with the DXUT framework which needs UNICODE defined in the project. Yet whenever I use a WriteFile call, the characters in my log files all have spaces in between them (I'm assuming because they're writing out as wide characters).. Anyways, is there a clean way to do WriteFile calls or what are people using for logging in UNICODE-land?? thanks
Learn about game programming!Games Programming in C++: Start to Finish
Advertisement
I'm not quite sure which WriteFile() function you are speaking of. The only one I could find was in the .NET framework (I am assuming you are using C++ since you mentioned UNICODE was defined). However, I know that in C++ there is a fwprintf() function that prints wide-characters to a file. Actually, all of the native char methods have a wide-char counter-part (most are simply prefixed with "w").
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Easiest solution I think is to simply make your logfile unicode compliant, and simply start the file with the unicode character 0xFEFF (so in little-endian it appears as the sequence 0xFF 0xFE). Then Notepad can make sense of the rest.
.
Thanks Mastaba, I'll give that a shot.

Learn about game programming!Games Programming in C++: Start to Finish

This topic is closed to new replies.

Advertisement