Atoi / Atol - results in 0
I'm building quick "Configuration Reader" which reads settings from files.
Problem is, that function returns "800" character string and atol with
that input returns 0. I'm not sure what I'm doing wrong.
So, this is how it roughly looks like:
char *txtval=GetParamFromLine("WINDOW_WIDTH");
val = atol(txtval);
char* GetParamFromLine(char*parameter)
{
char text[16];
//
// do the reading procedure and fill the text
//
return text;
}
Result: atol(text) = 0 (where text = "800" )
Thanks for your help!
No comments:
Post a Comment