分类: C/C++
2008-09-08 10:53:37
#include
#include
main()
{
FILE * stream;
char string[] = "This is a test program!";
char msg[20];
stream = fopen("my.fil", "w+");
fwrite(string, strlen(string), 1, stream);
fseek(stream, 0, SEEK_SET);
fgets(msg, strlen(string) + 1, stream);
printf("%s", msg);
fclose(stream);
}