jagomaniak wrote:
> The program is written in C. :) I have the parameters check in my
> program already, I'm just struggling with how to write that loop.
> 
> char *c = argv[2];
> 
> while (*argv[2])
> {
>   if ((isupper(*argv[2])) || (isdigit(*argv[2])))
>   { continue; }
>   else
>    printf("Second parameter includes forbidden characters");
>    return EXIT_FAILURE;
> }
> 
> But that doesn't work.

You forgot to increment.

You might prefer to do something more like:

char *c;
for (c = argv[2]; *c && (isupper(*c) || isdigit(*c)); c++);
if (*c)
{
   printf("Second parameter includes forbidden characters.\n");
   return EXIT_FAILURE;
}

Instead.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to