C文件操作示例 #includes stdio.h> #include<string. h> int mainO FILE fp=fopen("test. txt", w+t); printf( erroe on openning!\n return-1 char strs/Ir This is the test line fwrite(str, sizeof(char), strlen(str), p) fpr printf(p, print=%/os",str)C文件操作示例 #include< #include<stdio.h stdio.h> #include< #include<string.h string.h> int main() { FILE *fp=fopen("test.txt","w+t fopen("test.txt","w+t"); if(!fp) { printf("erroe printf("erroe on openning! openning!\n"); return -1; } char * str="This is the test line"; ="This is the test line"; fwrite(str,sizeof(char),strlen(str),fp fwrite(str,sizeof(char),strlen(str),fp); fprintf(fp,"print fprintf(fp,"print= %s",str);