| | |
help please
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Feb 2009
Posts: 13
Reputation:
Solved Threads: 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
and my output is
can anybody explain this to me?
C++ Syntax (Toggle Plain Text)
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
C++ Syntax (Toggle Plain Text)
8178858588 8178858588 2147483647 (where i printed out the return)
can anybody explain this to me?
0
#2 Nov 4th, 2009
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?
How does that limit compare to the value you're trying to stuff into a long int?
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
![]() |
Other Threads in the C++ Forum
- Previous Thread: compiling multiple files using visual c++
- Next Thread: How to make the cout work when input is not integer in this simple program?
Views: 209 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






