Greetings,
I appears that I "broke" my isdigit() function
I was
using it to test arguments passed to a VERY simple (or
so I thought) command line DOS program. It was originally
evaluating input... but now appears to return 0 (which
according to my book & my debugging efforts means it
wasnt an integer) regardless of what value is passed to it.
Below is example code...
...in desparation I even commented out the "endl"'s
being passed to cout, thinking there was some remote
chance that these were being evaluated by the isdigit
function too (I know... but, like I said... desparate).
This is driving me nuts!!!!!!! What am I missing here?
I am sure this is going to be something I am going to
want to crawl under a rock when someone points out an
blatent miss... but until then, I cant find it for the
life of me.
Regards,
Tj
I appears that I "broke" my isdigit() function
using it to test arguments passed to a VERY simple (or
so I thought) command line DOS program. It was originally
evaluating input... but now appears to return 0 (which
according to my book & my debugging efforts means it
wasnt an integer) regardless of what value is passed to it.
Below is example code...
Code:
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
//process cmd line, see whats returned, currently always a 0 (zero)
cout << endl;
cout << "ATOI (v): " << atoi( argv[1] ) << endl;
cout << "ISDIG(v): " << isdigit( atoi( argv[1] ) ) << endl << endl;
//process a fixed string, see what happens (returns 0 for me)
char *tstStr = "3";
cout << "ATOI (s): " << atoi( tstStr ) << endl;
cout << "ISDIG(s): " << isdigit( atoi( tstStr ) ) << endl << endl;
//pass a freaking INT, which isdigit still says isnt a digit!?!?!?
int tstInt = 3;
cout << "VALUE(i): " << tstInt << endl;
cout << "ISDIG(i): " << isdigit( tstInt ) << endl << endl
return 0;
}
...in desparation I even commented out the "endl"'s
being passed to cout, thinking there was some remote
chance that these were being evaluated by the isdigit
function too (I know... but, like I said... desparate).
This is driving me nuts!!!!!!! What am I missing here?
I am sure this is going to be something I am going to
want to crawl under a rock when someone points out an
blatent miss... but until then, I cant find it for the
life of me.
Regards,
Tj