[問題] fopen的問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
linux
問題(Question):
程式要能夠以執行參數的方式指定要分析的檔案
餵入的資料(Input):
test.out ./test/AAA.txt
預期的正確結果(Expected Output):
正確的開啟AAA.txt
程式碼(Code):(請善用置底文網頁, 記得排版)
#include <stdio.h>
char *GS;
int main(char *argv[]){
GS=argv[1];
想問說如果我已經把./test/AAA.txt存在GS中
如何利用GS使用fopen來開AAA.txt
fopen("檔名","mode");檔名應該不能直接改成GS吧= =
還是有別的方法可以用?
FILE *slPtr;
if ((slPtr=fopen("AAA.txt","a+"))==NULL){
printf("file could not opened\n");
}
else{
fprintf(slPtr,"successfully write\n");
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.118.74.175
→
06/07 20:57, , 1F
06/07 20:57, 1F
→
06/07 21:03, , 2F
06/07 21:03, 2F
→
06/07 21:22, , 3F
06/07 21:22, 3F
討論串 (同標題文章)