CookieMonster has been thinking (<<<a dangerous thing ) a lot about streams.
Here's is what I did to solve my problem. Now this is only a small program, but I'd just like to know if this would work for bigger programs in the future:
Code:
int main ()
{
...
scanf(" %i", &menuoption);
switch(menuoption)
{
case 1: menuoption1();break;
case 2: menuoption2();break;
case 3: menuoption3();break;
...
}
Code:
void menuoption3(void)
{
FILE *textfile;
char insertedtext[30];
textfile=fopen(".\\textfiles\\usertext.txt","w");
printf("\n\nPlease enter in your text you wish to assess."
"\nYou have a limit of 3000 characters."
"\nTo finish, please press enter.\n\n");
scanf(" %s",&insertedtext);
fputs(insertedtext,textfile);
fclose(textfile);
statisticsoftextfile ("User Text",".\\textfiles\\usertext.txt");
}
The difference is the space that I put before the % in the scanf's in each of the two functions.
And another noob question: What is so bad about using void main (void), because I've been using it for the past 5 months or so.
I only ask after seeing Salem's avatar!
Why didn't someone inform me of the atrocity void main (void) committed?