C语言-C语言程序设计-文件操作
#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(char 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;
}
标签:fp,文件,ch,C语言,FILE,txt,程序设计,fopen
From: https://www.cnblogs.com/yongchao/p/17158327.html