#include <iostream>
#include <cstdio>
usingnamespace std;
int main(int argc, char* argv[])
{
FILE *fp;
char ch;
if(argc!=2)
{
cout<<"You should enter a filename"<<endl;
return 1;
}
if((fp=fopen(argv[1],"w"))==NULL)
{
cout<<"Can't open the file"<<endl;
return 1;
}
do
{
ch=getchar();
putc(ch,fp);
}while(ch!="."); //mistake here but I don't know the way to correct it
fclose(fp);
return 0;
}
Compiler gives a mistake:
error: ISO C++ forbids comparison between pointer and integer