parsing command line

This is a discussion on parsing command line within the C++ Programming forums, part of the General Programming Boards category; Hi there,
I have done a fair amount of research in order to figure out how to parse a command ...

parsing command line

Hi there,

I have done a fair amount of research in order to figure out how to parse a command line for, say, and integer. The code below almost works, except when the user types in, for example, "4s". The result is that find_this_number gets assigned 4, whereas I would prefer to reject the input "4s" because the string does not represent an integer.

Some people have recommended using the boost library, but I would like to know if there is a way to do this using either strict C or the STL libraries only. Can you please help? Thanks!