Unicode problems

This is a discussion on Unicode problems within the Windows Programming forums, part of the Platform Specific Boards category; Lately I've been trying to adopt to Unicode. So im using LPSTR LPSWSTR and what not. What I'm having trouble ...

  1. #1
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483

    Unicode problems

    Lately I've been trying to adopt to Unicode. So im using LPSTR LPSWSTR and what not.

    What I'm having trouble with is sprintf, as far as i know it only works with char* and they are 1 byte in size, where as UNICODE characters are 2 bytes.

    Is there a function that'll do the same thing as sprintf that works with wchar_ts?

    EDIT:

    swprintf... wow that was hard to figure out.

    I'm sorry for the useless post.
    Last edited by mrafcho001; 03-30-2006 at 04:43 PM.
    My Website
    010000110010101100101011
    Add Color To Your Code!

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can find a list of the wchar functions in <wchar.h>. Also if do a search for a funciton on msdn (function msdn in your favourite search engine), it will list the corresponding wide character version. Finally, you may be interested in <tchar.h>. This has macros that you can use with TCHARs. These resolve to wchar_t, if UNICODE and _UNICODE are defined, and normal char otherwise.

    I have to warn you, that when it comes to outputting or inputting strings to/from the console or a file, the C run-time unicode functions can be a mess.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problems in finding unicode values
    By kris52 in forum C Programming
    Replies: 1
    Last Post: 05-26-2007, 09:28 AM
  2. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  3. Unicode - a lot of confusion...
    By Jumper in forum Windows Programming
    Replies: 11
    Last Post: 07-05-2004, 07:59 AM
  4. Should I go to unicode?
    By nickname_changed in forum C++ Programming
    Replies: 10
    Last Post: 10-13-2003, 11:37 AM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21