Thread: wchar_t to char

  1. #1
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355

    wchar_t to char

    Hey all,

    Does anyone know of a quick and easy way to convert wchar_t to char? Like a standard function of something. Or is using a simple cast ok?

    I thought unicode was the way to go, then I try to use OpenFile() (win32) and it's a char only function!
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    OpenFile is deprecated to my knowledge....use CreateFile - the windows SDK will allow you to use this for Widechar and ASCII....

    If you are ever forced to do this at runtime, try WideCharToMultiByte

  3. #3
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Thanks Fordy.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  4. #4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 07:36 AM
  3. code condensing
    By bcianfrocca in forum C++ Programming
    Replies: 4
    Last Post: 09-07-2005, 09:22 AM
  4. Passing structures... I can't get it right.
    By j0hnb in forum C Programming
    Replies: 6
    Last Post: 01-26-2003, 11:55 AM
  5. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM