I have written function that allows a user to enter a long string of text into a file:

Code:
void menuoption3(void)
{
	FILE *textfile;
	char insertedtext[30];
	textfile=fopen(".\\textfiles\\temp.txt","w");

	printf("\n\nPlease enter in your text."
                "\nTo finish, please press enter.\n\n");
	gets(insertedtext);
	fputs(insertedtext,textfile);
	fclose(textfile);
}

If I put this function as a main one i.e. void main (void), is works fine, temp.txt is changed to whatever the user types.

However, when I use this function being called by another function (shown below), the "gets" function is missed, as in I'm not given a chance to write anything.

The menuoption3() function is called from the main function in a switch function like this:

Code:
void main (void)
....
switch(n)
...
	case 2: menuoption2();break;
	case 3: menuoption3();break;
	case 4: menuoption4();break;
....
So why doesn't the "gets" function allow me to type data at runtime?

Thanks in advance,
CookieMonster