CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Converting a string to int

    Hi,
    I have the variable char temp[8].
    With this variable the user can enter a single character
    or an 8 digit number.
    When the user enters an 8 digit number I need to be able to convert
    the variable into an int variable.
    Does anyone know how to do this.



  2. #2
    Join Date
    Apr 1999
    Posts
    29

    Re: Converting a string to int

    You can use the standard C++ function 'atoi()' to convert a from char to int. In your case this would look something like this :

    char temp[8];


    ... user entry stuff ...
    int result = atoi(temp);



    Good Luck, Pras


  3. #3
    Guest

    THANKS

    Thanks
    it worked


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