Actually, I'm not using args to main. It's a simple shell program , and command is a struct that holds the parsed command line that was entered by the user. I changed it a little bit, so I use this for loop to examine the contents of the argv array:
Code:
for(k = 0; command.argv[k] != NULL; k++) printf("Arg %i : %s\n", k, command.argv[k]);
Then here is the full if statement:
Code:
for(k = 0; command.argv[k] != NULL; k++)
if(command.argv[k] == '>')
{
printf("DFSDF");
redirectOut = TRUE;
command.argv[k] = '\0';
filename = command.argv[k+1];
command.argv[k+1] = '\0';
}
The for loop outputs this:
Arg0: ls
Arg1: >
Arg2: textfile
Yet the if statement is never entered. I am befuddled.