Sorry if it was already asked before, but I really couldn’t find a clear answer to this question.
Please, tell me, what is the fastest way of converting:
char * array to int
char * array to float
char * array stores a number, for example:
"12345"
"1234,56789"
If the fastest ways for x86 and x64 systems are different, please tell both of them.
EDIT: By “fastest”, I mean “the most efficient”, not “the most simple to use”.
Start with atoi() and atof(), measure the speed, decide if it’s a problem – then look for a solution
edit – it’s almost certain that the I/O will dominate any time spent doing the conversion. If the conversion time does matter (after you profile) then if you know the format ie. ints are always 4digits, floats always have 5 decimal places, you might be able to write a hand tuned routine that does better than the standard lib