Shouldn't be too difficult, based on what you say you've done already. Reading from the command prompt is just like reading from a file.
I guess your code is something like
Code:
int main(void)
{
.... read file and print it
}
So you just slot options reading in before you do anything else. I'd structure it like:
Code:
int main(void)
{
buffer[MAX_STRING_LENGTH];
while (fgets(buffer, MAX_STRING_LENGTH, stdin)) // this will stop when EOF is detected. EOF is Ctrl+Z on windows. you might want to accept an 'exit' command as well (see below).
{
if (strcpy(buffer, "read") == 0)
.... read file and print it
else if (strcpy(buffer, "exit") == 0)
break; // exit while loop.
}
}
Hope that helps.