[问题] C file processing的档案到底存在哪里

楼主: rareone (拍玄)   2016-01-04 06:37:49
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
OS X
Xcode
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
只有stdio.h
问题(Question):
使用资料存取的档案时,找不到档案到底存在哪
喂入的资料(Input):
none
预期的正确结果(Expected Output):
恩...是生出一个叫oldname.txt的档案吧
错误结果(Wrong Output):
找不到档案
程式码(Code):(请善用置底文网页, 记得排版)
#include <stdio.h>
int main(void)
{
unsigned int account;
char name[30];
double balance;
FILE *cfPtr;
if ((cfPtr = fopen("oldname.txt", "w"))==NULL) {
puts("File could not be opened");
}
else {
puts("Enter the account, name, and balance.");
puts("Enter EOF to end input");
scanf("%d%29s%lf",&account, name, &balance);
while(!feof(stdin)){
fprintf(cfPtr,"%d %s %.2f\n",&account,name,&balance);
scanf("%d%29s%lf",&account,name,&balance);
}
}
return 0;
}
补充说明(Supplement):
作者: LPH66 (-6.2598534e+18f)   2016-01-04 07:29:00
我觉得你写支程式 system("ls"); 看看比较快基本上它会在所谓的“目前工作目录”里但当你从 IDE 里执行时那是哪里各 IDE 有所不同那这样不如直接执行一个能告诉你目前目录所在地的指令ls 是其一, pwd 也可以用(pwd 全名就是 print working directory, "印出工作目录")
作者: watermeter (水表)   2016-01-04 10:09:00
谢谢LP大,我去Google 看看

Links booklink

Contact Us: admin [ a t ] ucptt.com