第一,我可以说得很好。 请理解:
当我试图打开文本档案,以用斜线书写一些东西时,例如FILE *f = f open(“data.txt”,“w”);
,我无法找到数据。 txt文档任何地方,不仅现有目录,而且在Windows探测器上。 BUT. 未经档案的劳动罚款:
我有疑虑,因此,我曾尝试过这个<代码>FILE *f = f open(“c:my. data.txt”、“w”);。 具体指明道路、工作良好!
我知道,文本档案存放在与执行档案夹相同的夹中。
Of course, Other IDE is working very well.(MSVS or Dev C++) What s my problem??
(一米使用Windows7和gvim)
// Modification
// source code
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *f = NULL;
int name[10];
if((f = fopen("data.txt", "w")) == NULL){
printf("sorry..
");
system("pause");
exit(1);
}
fprintf(f, "%s
", "Dennis");
fclose(f);
if((f = fopen("data.txt", "r")) == NULL){
printf("sorry2..
");
system("pause");
exit(1);
}
fscanf(f, "%s", name);
printf("%s
", name);
fclose(f);
system("pause");
return 0;
} // I think it s no problem. I ve tried different ways to try several times.
I will compile this -> map :! gcc % -o %<.exe (in vimrc. file) Push Cntl + F9. Vim 7.3, MingW 0.1-alpha-5. I just coding some source code, there are fopen(), fprintf() and fscanf(). When I tried to write on text file that I opened file, something was written there. but I could not see the text file. And, I tried to read the text file that I wrote file, although It was open, could not be read. Windows Explorer could not find the text file.