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. char[260] to LPWSTR conversion error??????

char[260] to LPWSTR conversion error??????

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
9 Posts 6 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.
  • T Offline
    T Offline
    TooShy2Talk
    wrote on last edited by
    #1

    Hi again, I'm using UNICODE char set and have this error of converting char[260] to LPWSTR and... CString to LPCSTR I'm not familiar with UNICODE but i have to use it. Hope you can help me. Thanks.

    T R 2 Replies Last reply
    0
    • T TooShy2Talk

      Hi again, I'm using UNICODE char set and have this error of converting char[260] to LPWSTR and... CString to LPCSTR I'm not familiar with UNICODE but i have to use it. Hope you can help me. Thanks.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      why don't you just always use CString with LPC**T**STR ??? when you handle literals, just round them with the _T() macro... that way, you don't even have to think to convert from ascii to unicode and vice versa... for example:

      CString str = _T("Hello World !");

      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      1 Reply Last reply
      0
      • T TooShy2Talk

        Hi again, I'm using UNICODE char set and have this error of converting char[260] to LPWSTR and... CString to LPCSTR I'm not familiar with UNICODE but i have to use it. Hope you can help me. Thanks.

        R Offline
        R Offline
        rowdy_vc
        wrote on last edited by
        #3

        Change into property settings ...use project->configuration property->general see, character set change into multibyte characterset.. then your code is running proper..

        *****THANKS N ADVANCE**** Mathen.K (I WILL TRY MY LEVEL BEST )

        R T M T 4 Replies Last reply
        0
        • R rowdy_vc

          Change into property settings ...use project->configuration property->general see, character set change into multibyte characterset.. then your code is running proper..

          *****THANKS N ADVANCE**** Mathen.K (I WILL TRY MY LEVEL BEST )

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          TooShy2Talk wrote:

          I'm not familiar with UNICODE but i have to use it.

          rowdy_vc++ wrote:

          see, character set change into multibyte characterset..

          Are you answering queries without even understanding them?

          Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

          1 Reply Last reply
          0
          • R rowdy_vc

            Change into property settings ...use project->configuration property->general see, character set change into multibyte characterset.. then your code is running proper..

            *****THANKS N ADVANCE**** Mathen.K (I WILL TRY MY LEVEL BEST )

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            go round a problem won't fix it. the OP has a problem of design in his code, and he'd better fix that first...

            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            1 Reply Last reply
            0
            • R rowdy_vc

              Change into property settings ...use project->configuration property->general see, character set change into multibyte characterset.. then your code is running proper..

              *****THANKS N ADVANCE**** Mathen.K (I WILL TRY MY LEVEL BEST )

              M Offline
              M Offline
              Maxwell Chen
              wrote on last edited by
              #6

              We have seen many posts of questions by you. We know your level.

              Maxwell Chen

              1 Reply Last reply
              0
              • R rowdy_vc

                Change into property settings ...use project->configuration property->general see, character set change into multibyte characterset.. then your code is running proper..

                *****THANKS N ADVANCE**** Mathen.K (I WILL TRY MY LEVEL BEST )

                T Offline
                T Offline
                TooShy2Talk
                wrote on last edited by
                #7

                But if i have to change it to MultiByte char other codes have to be converted to MultiByte. Changing those codes are more work than fixing this conversion. I just download sample source code and combine them altogether but problem such this arises due to this. Hope you can help me. Thanks.

                T CPalliniC 2 Replies Last reply
                0
                • T TooShy2Talk

                  But if i have to change it to MultiByte char other codes have to be converted to MultiByte. Changing those codes are more work than fixing this conversion. I just download sample source code and combine them altogether but problem such this arises due to this. Hope you can help me. Thanks.

                  T Offline
                  T Offline
                  toxcct
                  wrote on last edited by
                  #8

                  read the other replies. this guy answered you, but he doesn't even know what he talks about. so don't take his post in consideration; it's useless.

                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  1 Reply Last reply
                  0
                  • T TooShy2Talk

                    But if i have to change it to MultiByte char other codes have to be converted to MultiByte. Changing those codes are more work than fixing this conversion. I just download sample source code and combine them altogether but problem such this arises due to this. Hope you can help me. Thanks.

                    CPalliniC Offline
                    CPalliniC Offline
                    CPallini
                    wrote on last edited by
                    #9

                    Since you have to adapt different pieces of code, IMHO the best approach is to uniform the whole project to generic text mappings [^], as already suggested by toxcct. It should be not such a daunting task (hopefully). :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                    In testa che avete, signor di Ceprano?

                    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