c语言,用1.exe读取1.txt

c语言,用1.exe读取1.txt1.txt是文件内容,上面的第二行写着:数字: 1 2 3 。。。
1.exe是本体,用来读取1.txt的内容,可以读取并显示 1 2 3 (没有 '数字')。。
这个怎么写这个1.exe里的内容。。

代码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;
}

温馨提示:答案为网友推荐,仅供参考
相似回答