One of my assignments in to write my own UNIX Shell. To receive input from the user, I am using fgets to capture the input as a string but I\'m not really sure how it works.
Probably the easiest way to handle this is to switch to using scanf to read the input:
scanf
char command[51]; scanf("%50[^\n]", command); if (0 == strcmp(command, "exit")) do_something();