I have a program that requires the user to enter an integer as a command line argument, in the form of ./program 100
.
Obviously this will read the value in as a string, so I need to parse it to an integer. I have to ensure that the input value won't overflow an integer variable. I have read about strtol()
, but it works with long
variables and I have to stick with a regular int
.
Is there anything similar that can be used for an int
?