文件的输入
- #include <stdio.h>
- #include <string.h>
- int main(int argc, const char * argv[]) {
- FILE *fp = fopen("fwrite块.txt","r" );
- char *str = "Welcome to beiJing!";
- if (fp != NULL) {
- fwrite(str, 1, strlen(str), fp);
- char ch[100];
- fread(ch, sizeof(ch), 1, fp);
- printf("%s",ch);
-
- }
-
- fclose(fp);
-
- }
复制代码
|
|