fp=fopen(pn, "r+b");
printf("This file's content is:\n");
ch = fgetc(fp);
//printf("%d",0xff);//255
if (ch == EOF || ch == -1 || ch == '\0')//如果是空文件。由于WEOF在wchar.h中。我们没有考虑
//把这个程序写成支持英文以外的符号。所以,我们不用WEOF也可以。
//注意,这个程序只保证支持英文。其他语言的支持情况根据操作系统平台不同而表现不同。
//所以,只保证英文,不保证其他语言。不能对其他语言打包票。
//对了,WEOF的值经过测试也是-1。
printf("This file is empty.\n");//这个文件是空的。
if (ch == 255 || ch == 0xff)
// printf("This is a empty file on Android phone.\nAnd It's of C language created.\n");
// printf("This is a empty file. And it haven't wrote 网页链接 is new empty file.\n");
printf("This is a empty file.\n");
while (!feof(fp))
{
printf("%c", ch);
ch = fgetc(fp);//getc()也可以。
//if(ch == EOF)
//if(feof(fp))
/*当设置了与流关联的文件结束标识符时,该函数返回一个非零值,否则返回零。
*/
/*也就是说,到达文件结尾返回非零,否则返回零
*/
/* {
printf("\n\n");
break ;
}*/
//break;
//printf("%c", ch);
}
printf("\n\n");
cursor_move_menu_start:;
printf("\"Edit file\"function exited.\nCursor move menu:\n\t1: cursor move to left(ESC exit)\t\t2: cursor move to right(ESC exit)\n\t3: cursor move to upper(ESC exit)\t\t4: cursor move to down(ESC exit)\n\t5: Shut file and exit \"Edit file\"function.\n\nYour select is:\n");
printf("This file's content is:\n");
ch = fgetc(fp);
//printf("%d",0xff);//255
if (ch == EOF || ch == -1 || ch == '\0')//如果是空文件。由于WEOF在wchar.h中。我们没有考虑
//把这个程序写成支持英文以外的符号。所以,我们不用WEOF也可以。
//注意,这个程序只保证支持英文。其他语言的支持情况根据操作系统平台不同而表现不同。
//所以,只保证英文,不保证其他语言。不能对其他语言打包票。
//对了,WEOF的值经过测试也是-1。
printf("This file is empty.\n");//这个文件是空的。
if (ch == 255 || ch == 0xff)
// printf("This is a empty file on Android phone.\nAnd It's of C language created.\n");
// printf("This is a empty file. And it haven't wrote 网页链接 is new empty file.\n");
printf("This is a empty file.\n");
while (!feof(fp))
{
printf("%c", ch);
ch = fgetc(fp);//getc()也可以。
//if(ch == EOF)
//if(feof(fp))
/*当设置了与流关联的文件结束标识符时,该函数返回一个非零值,否则返回零。
*/
/*也就是说,到达文件结尾返回非零,否则返回零
*/
/* {
printf("\n\n");
break ;
}*/
//break;
//printf("%c", ch);
}
printf("\n\n");
cursor_move_menu_start:;
printf("\"Edit file\"function exited.\nCursor move menu:\n\t1: cursor move to left(ESC exit)\t\t2: cursor move to right(ESC exit)\n\t3: cursor move to upper(ESC exit)\t\t4: cursor move to down(ESC exit)\n\t5: Shut file and exit \"Edit file\"function.\n\nYour select is:\n");
