views:

45

answers:

1

Is there an alternative, either built into windows or apache license compatible, to stoll() for Visual Studio 2008. Even installing the windows 7 platform SDK does not add stoll() to the string header.

On unix the same function is be called strtoll().

+2  A: 

You can use _strtoi64. It's declared in stdlib.h.

long long num = _strtoi64(str, NULL, 10);

Similarly to strtoll, you can pass a char ** endptr as a second parameter. If so, *endptr will be set to the first invalid character (which may be the normal null-terminator).

Matthew Flaschen
Thats the great thing about standards, so many to chose from.
Justin Dearing
@Justin, yeah, but even Microsoft doesn't pretend this one's standard. :)
Matthew Flaschen