help please

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2009
Posts: 13
Reputation: Brandon515 is an unknown quantity at this point 
Solved Threads: 0
Brandon515 Brandon515 is offline Offline
Newbie Poster

help please

 
0
  #1
20 Days Ago
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
  1. cout << file << endl << file.c_str() << endl; // debugging purposes
  2. num = strtol(file.c_str(), &pEnd, 10); // actual conversion
  3. return num; // return

and my output is
  1. 8178858588
  2. 8178858588
  3. 2147483647 (where i printed out the return)

can anybody explain this to me?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,673
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso
 
0
  #2
20 Days Ago
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?
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 13
Reputation: Brandon515 is an unknown quantity at this point 
Solved Threads: 0
Brandon515 Brandon515 is offline Offline
Newbie Poster
 
0
  #3
20 Days Ago
ah, right. thx again man.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC