Does function strtol work??

This is a discussion on Does function strtol work?? within the C++ Programming forums, part of the General Programming Boards category; No, a string or a cstring are containers. Ints and chars are scalars, if you will. You can refer to ...

  1. #16
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    902
    No, a string or a cstring are containers. Ints and chars are scalars, if you will. You can refer to the i'th character in a string or array of chars using [i] (starting at zero). Those you can cast to ints.
    Last edited by CodeMonkey; 07-17-2010 at 07:39 PM. Reason: typo
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #17
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by CodeMonkey View Post
    No, a string or a cstring are containers. Ints and chars are scalars, if you will. You can refer to the i'th character in a string or array of chars using [i] (starting at zero). Those you can cast to ints.
    Yeah, realized that, but I'm using string::at(0) instead of the string [] operator, which will also work:
    http://codepad.org/syOCO6Mq

    Thanks for the help.
    Last edited by Programmer_P; 07-17-2010 at 07:55 PM.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  5. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 07:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21