[問題] 求救 開檔遇到問題
case1 請問為什麼檔案開啟會失敗呀??急 謝謝!!
02 #include <stdio.h>
03 #include <stdlib.h>
04 int main(void)
05 {
06 FILE *fptr1,*fptr2;
07 char ch;
08 int count=0;
09
10 fptr1=fopen("c:\\prog\\welcome.txt","r");
11 fptr2=fopen("c:\\prog\\output.txt","w");
12
13 if((fptr1!=NULL) && (fptr2!=NULL))
14 {
15 while((ch=getc(fptr1))!=EOF)
16 {
17 putc(ch,fptr2);
18 count++;
19 }
20 fclose(fptr1);
21 fclose(fptr2);
22 printf("檔案拷貝完成!!\n");
23 printf("總共有%d 個字元\n",count);
24 }
25 else
26 printf("檔案開啟失敗!!\n");
27
28 return 0;
29 }
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.170.5.105
→
04/08 02:03, , 1F
04/08 02:03, 1F
→
04/08 02:38, , 2F
04/08 02:38, 2F
※ 編輯: fr054178 來自: 118.170.7.109 (04/08 02:38)
推
04/08 03:31, , 3F
04/08 03:31, 3F
→
04/08 03:31, , 4F
04/08 03:31, 4F
→
04/08 03:32, , 5F
04/08 03:32, 5F
→
04/08 03:32, , 6F
04/08 03:32, 6F
→
04/08 06:20, , 7F
04/08 06:20, 7F