[問題] 系統找不到路徑@.@......

看板C_and_CPP (C/C++)作者 (薯)時間16年前 (2009/09/05 15:00), 編輯推噓4(406)
留言10則, 4人參與, 最新討論串1/2 (看更多)
#include <stdio.h> #include <stdlib.h> #include <string.h> void main() { FILE *fp = fopen("C:\\Documents and Settings\\Mickey\\桌面\\CSO\\Cheater\\123.txt", "r") , *fw = fopen("C:\\Documents and Settings\\Mickey\\桌面\\CSO\\Cheater\\321.txt", "w"); char String[50]; while (!feof(fp)) { fscanf(fp,"%s\n", &String); if ((strcmp(String, " ") == 0)||(String[0] == '\n')||(String[0] == ' ')) fscanf(fp,"%s\n", &String); fprintf(fw,"%s\n",String); } fclose(fp); fclose(fw); system("del C:\\Documents and Settings\\Mickey\\桌面\\CSO\\Cheater\\123.txt"); } 這是一個小小的程式 我只是想要把讀取的123.txt刪掉 留下產生的321.txt 可是執行後 中間的程式碼都沒問題 都有照我要做的去做 唯讀最後一行 console跟我說:系統找不到指定的路徑 @.@" ........ 它都讀的到123.txt了 而且也能幫我做我要的動作 為什麼最後不能刪除? 第一次碰system("del ** "); 這個指令 請各位大大解答 謝謝^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.134.115.251

09/05 15:44, , 1F
用這個看看 DeleteFile
09/05 15:44, 1F

09/05 15:51, , 2F
應該是可以才對 我測試了可以 就算有中文也OK
09/05 15:51, 2F

09/05 19:24, , 3F
請問DeletFile 要include 什麼嗎? 我使用他說是未定義的東
09/05 19:24, 3F

09/05 19:24, , 4F
西
09/05 19:24, 4F

09/05 23:32, , 5F
"del C:\\Documents => del "C:\\Documents
09/05 23:32, 5F

09/05 23:33, , 6F
推錯了....Orz
09/05 23:33, 6F

09/05 23:34, , 7F
"del \"C:\\Documents .... \\321.txt\""
09/05 23:34, 7F

09/05 23:34, , 8F
簡單的說把要del的完整路徑用雙引號""括起來試試:)
09/05 23:34, 8F

09/05 23:50, , 9F
樓上請教為啥要這樣做呀?? 我沒有刮起來也可以刪耶@@
09/05 23:50, 9F

09/05 23:59, , 10F
我有點懶, 直接回文騙P幣吧....
09/05 23:59, 10F
文章代碼(AID): #1AeWo7fj (C_and_CPP)
文章代碼(AID): #1AeWo7fj (C_and_CPP)