Jump to content
  • Advertisement
Sign in to follow this  

Using WriteFile with UNICODE

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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").

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!