0

hey guys, ok here's the situation. i need to turn a C++ style string into an integer now i've used altoi and strtol but they give me different numbers. heres my code

cout << file << endl << file.c_str() << endl; // debugging purposes
    num = strtol(file.c_str(), &pEnd, 10); // actual conversion
    return num; // return

and my output is

8178858588
8178858588
2147483647 (where i printed out the return)

can anybody explain this to me?

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Brandon515
0

What's the largest value that can be stored in a long int?

How does that limit compare to the value you're trying to stuff into a long int?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.