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?

Recommended Answers

All 2 Replies

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?

ah, right. thx again man.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.