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. CString to Integer

CString to Integer

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 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.
  • S Offline
    S Offline
    Shanmuga Sundar
    wrote on last edited by
    #1

    hai everybody., Can any say how to convert an CString to an integer value. I know to convert char buff[20] to an integer thro atoi function. Meanwhile if any one have any logical ideas or some thing special for convert the CString value to an integer value. I tried a lot. Thank in previous., Bye Anbudan., Shanmuga Sundar.V

    D A A G 4 Replies Last reply
    0
    • S Shanmuga Sundar

      hai everybody., Can any say how to convert an CString to an integer value. I know to convert char buff[20] to an integer thro atoi function. Meanwhile if any one have any logical ideas or some thing special for convert the CString value to an integer value. I tried a lot. Thank in previous., Bye Anbudan., Shanmuga Sundar.V

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      CString str = "123"; int i = atoi((LPCTSTR)str); This is a valid conversion, CString explicitely supports a conversion to LPCTSTR. :-D Dominik


      _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

      1 Reply Last reply
      0
      • S Shanmuga Sundar

        hai everybody., Can any say how to convert an CString to an integer value. I know to convert char buff[20] to an integer thro atoi function. Meanwhile if any one have any logical ideas or some thing special for convert the CString value to an integer value. I tried a lot. Thank in previous., Bye Anbudan., Shanmuga Sundar.V

        A Offline
        A Offline
        Aisha Ikram
        wrote on last edited by
        #3

        That's the only way i know. There is wtoi which deals with wide char string to int. That's it. @!$h@

        1 Reply Last reply
        0
        • S Shanmuga Sundar

          hai everybody., Can any say how to convert an CString to an integer value. I know to convert char buff[20] to an integer thro atoi function. Meanwhile if any one have any logical ideas or some thing special for convert the CString value to an integer value. I tried a lot. Thank in previous., Bye Anbudan., Shanmuga Sundar.V

          A Offline
          A Offline
          Abhishek Srivastava
          wrote on last edited by
          #4

          Hi friend ,:) it is as smiple as that CString str="1235678"; int a = atoi(str.operator LPCTSTR()); now try this :) "This world is a compliler, I am compiling my life and trying to make it error free :D" Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)

          1 Reply Last reply
          0
          • S Shanmuga Sundar

            hai everybody., Can any say how to convert an CString to an integer value. I know to convert char buff[20] to an integer thro atoi function. Meanwhile if any one have any logical ideas or some thing special for convert the CString value to an integer value. I tried a lot. Thank in previous., Bye Anbudan., Shanmuga Sundar.V

            G Offline
            G Offline
            GeraldoLuiz
            wrote on last edited by
            #5

            Hi, You can also use the Win32 API (Shell API) function if you want to avoid the CRT (C Run-Time Library) (If you use ATL/WTL for example) StrToInt(LPCTSTR lpSrc); Also check the others string functions from Win32 API (Platform SDK) and the Shell API (shlwapi.h). They mimic almost every string function from C++ library. Geraldo.

            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