Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to TURN UNICODE ON.

How to TURN UNICODE ON.

Scheduled Pinned Locked Moved C / C++ / MFC
testingbeta-testinghelptutorial
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HAHAHA_NEXT
    wrote on last edited by
    #1

    Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.

    D S 2 Replies Last reply
    0
    • H HAHAHA_NEXT

      Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you also defined UNICODE (in addition to _UNICODE)? Make sure they are both defined as close to the top of stdafx.h as possible. With both defined, TCHAR will resolve to unsigned short. Otherwise it will resolve to char.


      "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

      H 1 Reply Last reply
      0
      • D David Crow

        Have you also defined UNICODE (in addition to _UNICODE)? Make sure they are both defined as close to the top of stdafx.h as possible. With both defined, TCHAR will resolve to unsigned short. Otherwise it will resolve to char.


        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

        H Offline
        H Offline
        HAHAHA_NEXT
        wrote on last edited by
        #3

        Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.

        D M 2 Replies Last reply
        0
        • H HAHAHA_NEXT

          Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          #ifdef _UNICODE
          swprintf(...);
          #else
          sprintf(...);
          #end


          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

          H 1 Reply Last reply
          0
          • D David Crow

            #ifdef _UNICODE
            swprintf(...);
            #else
            sprintf(...);
            #end


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            H Offline
            H Offline
            HAHAHA_NEXT
            wrote on last edited by
            #5

            Thx again. Now everything works perfectly but the code is unreadable :rolleyes:

            G 1 Reply Last reply
            0
            • H HAHAHA_NEXT

              Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              Use _stprintf() See the full list of macros here[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot stop me with paramecium alone!

              1 Reply Last reply
              0
              • H HAHAHA_NEXT

                Thx again. Now everything works perfectly but the code is unreadable :rolleyes:

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #7

                Try looking at this article[^] in the MSDN. It describes the tchar.h mappings, which include _TCHAR equivalents for virtually all of the C runtime string routines.


                Software Zen: delete this;

                1 Reply Last reply
                0
                • H HAHAHA_NEXT

                  Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.

                  S Offline
                  S Offline
                  Sivaji
                  wrote on last edited by
                  #8

                  for that u have to change settings. step1: go to project->settings->c/c++->cateogery in that select preprocessor. in preprocessor defnitions txt box _MBCS to _UNICODE step2: in link tab goto category.select output. in entry point textbox write this 'wWinMainCRTStartup' Thats all.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups