[問題] 開關檔案問題
在我尚未加上fprintf() 之前開檔似乎很順利,但在使用fprintf(fp,"%lf",AA)
後卻意外的會跳出錯誤訊息@@: 怎麼會這樣呢?
-----------------------------------
File:fprintf.c
Line:56
Expression: str!=NULL
-----------------------------------
程式碼如下:
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int AA=10;
FILE *fp;
char mystring[100];
fp=fopen("C:\Test.txt","w");
if(fp== NULL)
{
printf("error open %s file to write\n");
exit(1);
}
// 在這加上fprintf()函數就不行了? fprintf()不是stdio.h內的東西嗎@@"
fprintf(fp,"%lf",AA);
//
fclose (fp);
system("pause");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.37.20.107
→
08/16 21:47, , 1F
08/16 21:47, 1F
→
08/16 21:48, , 2F
08/16 21:48, 2F
→
08/16 21:52, , 3F
08/16 21:52, 3F
→
08/16 22:01, , 4F
08/16 22:01, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章