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 convert a string to char so that i can get the ASCII value in vc++?

how to convert a string to char so that i can get the ASCII value in vc++?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 Posts 3 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.
  • N Offline
    N Offline
    nehathoma
    wrote on last edited by
    #1

    how to convert a string to char so that i can get the ASCII value in vc++?

    G D 2 Replies Last reply
    0
    • N nehathoma

      how to convert a string to char so that i can get the ASCII value in vc++?

      G Offline
      G Offline
      GDavy
      wrote on last edited by
      #2

      if you want to convert a CString, I used the following once in a similar situation. define the next: #if defined (_UNICODE) || defined (UNICODE) #define _tcstombs wcstombs #else #define _tcstombs strncpy #endif //in your code you can then convert CStrings to ascii strings-- CString sOriginalStr; .... //somewhere here sOriginalStr gets a value char* ascStr = new char[sOriginalStr.GetLength()+1]; _tcstombs(ascStr, sOriginalStr, sOriginalStr.GetLength()+1); .. //do your thing with the ascistring delete[] ascStr; Hope this gets you along... Greetz, Davy

      1 Reply Last reply
      0
      • N nehathoma

        how to convert a string to char so that i can get the ASCII value in vc++?

        D Offline
        D Offline
        deldeep
        wrote on last edited by
        #3

        //Let string be char string[]="acsd"; for(int i=0;i

        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