I would tackle this one thing at a time. All of it can be done with seperate functions called from main, for example:
Code:
int main() {
input=getuserinput();
condition=checkinput(input);
if (condition==x) printtofile(input);
else showonscreen(input);
}
One of the decisions you have to make is whether the function which gets the user input should also check it, or whether it should be checked by another function. The second way is better, since then you could have more than one kind of check function but probably only need a single, generic get-input function.
So the first thing you should try and do is write the getinput function and make sure it returns correct info back to main -- a possible sketch:
Code:
char *getinput() {
the function
}
int main() {
char input[256]; // size as appropriate
input=getinput();
printf("%s\n",input);
return 0;
}
Once you have this working, it will be easy to add more functions to complete the rest of your specifications.