Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert string to 64-bit integer.

Status
Not open for further replies.
I'm not sure about a MFC method, but the function
Code:
__int64 _atoi64( const char *string );
should do this work. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
_atoi64 is only available in Vc 7.0 from what I have been told.

 
?????????
Have you tried it?
It has been around at least since win95, i don't think visualC was born at that time...
Include <sdtlib.h> to use it... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Hi,
My mistake. I meant

_strtoi64

which is only available in Vc 7.0.


the difference is _strtoi64 has the side effect of advanacing the buffer pointer to the end of the parsed object so if you are trying to parse multiple i64 values on the same line you don't have to assume the user put white space between the values.
 
Thanks for the help guys. It looks like __atoi64 is the closest thing to what I'm looking for. Unfortunately, it doesn't read numbers in any base other than base 10, which doesn't suit me since I'm coding a compiler engine and must accept binary, octal, and hex as well.

It looks like I'm just going to make 64-bit math a compile-time option for my project, since my goal is 100% ANSI compliance, and the ANSI standard gets a bit fuzzy when you up it to 64-bit (integer-wise).

Thanks again for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top