#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * fp;
fp = fopen("./workspace/demoRead.txt", "r");
if(fp == NULL)
{
printf("file can not open.\n");
exit(1);
}
// fputc(ch, fp);
// fgetc(fp); 结束标志 EOF
//while((ch = fgetc(fp)) != EOF) putchar(ch);
// feof(fp) 非零 结束时值为0
// fwrite();
// fread();
// fseek();
// rewind(fp); 复位
// ftell(fp);
// fscanf() fprintf();
//
{
// 文件拷贝
// FILE *fBegin = fopen(".\workspace\demoRead.txt", "r");
// FILE *fEnd = fopen(".\workspace\demoWrite.txt", "w");
//
}
int iCode = fclose(fp);
printf("File close code is %d \n", iCode);
return 0;
}
C & C++
·
Note
C语言-C语言程序设计-文件操作
← Previous 数据结构(借鉴408)-高阶算法的应用