Hi,

I have problems using the stdlib function "strtol".

"strtol" always return 0 instead of the converted integer. The output of "printf" of the following simple example is "12 0"

long temp;
char test[3];

test[0] = '1';
test[1] = '2';
test[2] = 0;
temp = strtol(test, &endptr, 10);

printf("%s %ld ",test,temp);

If I use "atoi" instead of "strtol", everything works fine and the output of "printf" is "12 12 ".

Any ideas?

Thanks a lot.

Greetings,

    Wolfgang


--
Wolfgang Granzer
[email protected]
http://www.woif.org

Attachment: pgpFcIdeCoDJM.pgp
Description: PGP Digital Signature

Reply via email to