CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    Hampshire, UK
    Posts
    26

    Converting CString to int.

    How can I convert a CString, which has extracted the writing on a button (always a number in my app), into an ineteger that I can pass to a function taking integer values?

    thanks

    steve


  2. #2
    Join Date
    Sep 1999
    Location
    Europe / Austria / Innsbruck
    Posts
    442

    Re: Converting CString to int.

    Hi, simply use atoi function.

    CString str = "123";
    int n = atoi(str); // CString is casted automatically to LPCTSTR by the CString operator LPCTSTR





  3. #3
    Guest

    Re: Converting CString to int.

    Hi,
    use operator LPCTSTR ()for converting CString object.Then use atoi(LPCTSTR).
    Hope this helps you.

    Manash


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured