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 CString Variable to Integer data type

how to CString Variable to Integer data type

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestion
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.
  • P Offline
    P Offline
    phijophlip
    wrote on last edited by
    #1

    Hello friends, Can any one tell how to convert CString variable to integer data type? for example CString str1; int b; str1 = m_var1 ; m_var1 of string data type I want to assign str1 to b . Since str1 is type of CString , then is not possible to assign str1 to b. I need to convert the str1 variable to data type of b. then only the assign is possible. Can any one help me in this matter :)

    N H 2 Replies Last reply
    0
    • P phijophlip

      Hello friends, Can any one tell how to convert CString variable to integer data type? for example CString str1; int b; str1 = m_var1 ; m_var1 of string data type I want to assign str1 to b . Since str1 is type of CString , then is not possible to assign str1 to b. I need to convert the str1 variable to data type of b. then only the assign is possible. Can any one help me in this matter :)

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      CString strNumber = _T("2006");
      int nNumber = _ttoi(strNumber);


      Nibu thomas Software Developer

      1 Reply Last reply
      0
      • P phijophlip

        Hello friends, Can any one tell how to convert CString variable to integer data type? for example CString str1; int b; str1 = m_var1 ; m_var1 of string data type I want to assign str1 to b . Since str1 is type of CString , then is not possible to assign str1 to b. I need to convert the str1 variable to data type of b. then only the assign is possible. Can any one help me in this matter :)

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Hi phijophlip CString str; str="123"; int i=atoi(str);

        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