Problems with a C string and its ascii code

hey guys so in my C++ program i have a function that evaluates an input string from a file.

so i just want to show you my function really quick:

int code(char *input, double &val1)
{
int count = 0;
int pos = 0;

for (pos = 0; pos < sizeof(in); pos++)
{
if ((in[pos] <= '41)||(in[pos] == 44)||(in[pos] >= 58))
{
cout << "ERROR" << endl;
count = 0;
}
}
return count;
}

my problem here is that suppose the input string is 345
the function still outputs "ERROR" but in theory it should not be outputting anything right?
Please use [ code ] tags around your program (you can edit your own post to do this very easy). And you should check whether you copy'n'pasted it correctly from your source file. Some parts look strange.. (e.g. "...<= '41)||...")
Topic archived. No new replies allowed.