代码1.c
#include<stdio.h>
#define F_PATH "d:\\1.txt"
int main(){
char szTest[1000] = { 0 };
int len = 0;
FILE *fp = fopen(F_PATH, "r");
if (NULL == fp)
{
printf("failed to open dos.txt\n");
return 1;
}
while (!feof(fp))
{
memset(szTest, 0, sizeof(szTest));
fgets(szTest, sizeof(szTest)-1, fp);
printf("%s", szTest);
}
fclose(fp);
printf("\n");
return 0;
}