Results 1 to 8 of 8

Thread: Using Multi-Byte in place of Unicode

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using Multi-Byte in place of Unicode

    There's two versions of CreateFile:
    CreateFileA takes a ASCII parameters (char *)
    CreateFileW takes Unicode parameters (wchar *)

    Typically, if you have Unicode defined, CreateFileW is aliases to CreateFile, else CreateFileA is aliased to CreateFile.

    You can still use either by using the proper names:

    Qt Code:
    1. QString foo = "\\\\.\\COM1";
    2. CreateFileW(foo.utf16(), ...)
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. char foo[] = "\\\\.\\COM1";
    2. CreateFileA(foo, ...)
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to squidge for this useful post:

    TheDuncan (12th March 2010)

Similar Threads

  1. Converting from char to byte
    By Ferric in forum Newbie
    Replies: 2
    Last Post: 8th January 2010, 00:27
  2. Byte shifting in C
    By tntcoda in forum General Programming
    Replies: 3
    Last Post: 14th November 2008, 22:40
  3. Two Byte character Support
    By rajveer in forum General Programming
    Replies: 10
    Last Post: 25th October 2008, 00:29
  4. convert BYTE* to QString
    By tpf80 in forum Qt Programming
    Replies: 6
    Last Post: 8th April 2007, 10:29
  5. Can QByteArray takes place of BYTE?
    By hiuao in forum Qt Programming
    Replies: 2
    Last Post: 5th April 2007, 11:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.