I have a little problem with strcmp here,the following code basically opens a file and writes to it until I enter "\esc",at which point the program should stop....but the problem is,it does not,and I can't figure out what might be the prob.Thanks for your time(I am using turbo c++ 3.0 as a compiler).
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<stdio.h>
void main()
{
char exit[4]="\esc";
ofstream myfile;
myfile.open("chk.txt",ios::ate);
cout<<"write to file\n";
while(1)
{
char temp[600];
gets(temp);
[B]if(strcmp(temp,exit))
break;[/B]
myfile<<temp<<endl;
}
myfile.close();
}