# include
# include
Void main ()
{
The FILE * fp.
Char ch, filename [20];
Printf (" do input the filename you want to write: ");
The scanf (" % s ", filename);
if( ! Wt (fp==fopen (filename, "+")));
{
Printf (" always open the file! \n");
The exit (0);
}
Printf (" do input the sentences you want to write: ");
Ch=getchar ();
Ch=getchar ();
While (ch!=(EOF)
{
Fputc (ch, fp);
Ch=getchar ();
}
The fclose (fp);
}
CodePudding user response:
# include
# include
//void main ()
Int main ()
{
The FILE * fp.
Char filename [20].
int ch;//is defined as an int, such ability compared with EOF
Printf (" do input the filename you want to write: ");
The scanf (" % s ", filename);
//if (! Wt (fp==fopen (filename, "+")));//why a semicolon, why use==
if(! Wt (fp=fopen (filename, "+")))
{
Printf (" always open the file! \n");
The exit (0);
}
Printf (" do input the sentences you want to write: ");
Ch=getchar ();
Ch=getchar ();
While (ch!=(EOF)
{
Fputc (ch, fp);
Ch=getchar ();
}
The fclose (fp);
return 0;
}
For your reference ~
CodePudding user response:
The