Member Avatar
anu07

I am getting a "misplaced break" error from this part of the code,the following is a part of the mfile function,the while loop should break if the entered string in temp equals to the one in exit....I don't know why it shouldn't work,any help?Thanks.

ofstream myfile;
	myfile.open(fn,ios::ate);
	cout<<"File has been created. You may write to it now\n(enter '\esc' without inverted comma to close file).\n";
	char exit[4]="\esc";
	while(1);
	{
		char temp[600];
		gets(temp);
		if(strcmp(temp,exit)!=0)
		      [B]break;[/B]
		myfile<<temp;

	}
	myfile.close();
	mainmnu();

}

while(1); Drop the semicolon. ( while(1) )

Member Avatar
anu07

oh gosh!! thanks a lot LZSqr,what a stupid mistake I made,thanks. :)