close

標題:

免費註冊體驗

 

此文章來自奇摩知識+如有不便請留言告知

C wirte a text file

發問:

FILE*fp1; int num,i,c; if(!(fp1=fopen("file.txt","r"))) { printf("Error opening file.txt for writing."); return 1; }---------------------------------------------------------------------------------------如果個result 係 :ID Product... 顯示更多 FILE*fp1; int num,i,c; if(!(fp1=fopen("file.txt","r"))) { printf("Error opening file.txt for writing."); return 1; } --------------------------------------------------------------------------------------- 如果個result 係 : ID Product Quantity 01 ABC 2 ------------------------------------------------------------------------------------------ 應該點寫落去?? 更新: 我想將 ID Product Quantity 01 ABC 2 寫入去file.txt到 更新 2: sorry...我講得唔清楚 果d 01 ABC 2
最佳解答:

你想點??請講清楚!! 2010-05-11 13:01:26 補充: FILE*fp1; int num,i,c; if(!(fp1=fopen("file.txt","w"))) { printf("Error opening file.txt for writing."); return 1; } fprintf(fp1,"ID Product Quantity\n"); fprintf(fp1,"01 ABC 2\n"); fclose(fp1); 2010-05-11 13:58:40 補充: 那user需要輸入什麼,何時停止?輸入/輸出範例? 2010-05-12 14:13:36 補充: void orders() { int i,num; char input[81]; FILE *file; if(!(file = fopen("file1.txt","w"))) { printf("Error"); exit(100); } printf("\tHow many orders : "); scanf("%d",&num); for(i=0;i
其他解答:

user 要輸入 id ,product name, quantity. 另外,user search his order status by id or product name.!

arrow
arrow
    創作者介紹
    創作者 jjb973v 的頭像
    jjb973v

    飛航百科

    jjb973v 發表在 痞客邦 留言(0) 人氣()