作者hello881g (風)
看板C_and_CPP
標題[問題] xcode讀檔問題
時間Mon Sep 28 01:08:46 2015
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
xcode
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
希望把桌面上的txt檔輸入至xcode 中
但發現似乎無法輸入
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
int fn[link + 1], an[link + 1];
int i;
ifstream ifile("Macintosh://Users/Desktop/test.txt");
補充說明(Supplement):
之前讀的書皆是用ifile來進行讀檔,但書上提供的皆是在dev c++上
不曉得xcode的讀檔是不是有其他的限制存在
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.73.48.168
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1443373729.A.7C8.html
→ notBeing: 路徑錯誤, 改成"~/Desktop/test.txt"應該就可以了 09/28 02:03
→ hello881g: 修改後還是沒有跑出正確答案... 09/28 11:02
→ descent: 你先開個終端機, 先把檔案的路徑確定好, 不知道檔案放在, 09/28 11:05
→ descent: 怎麼開啟這個檔案 09/28 11:05
→ hello881g: !!已找出解決方法!!!感謝大大 09/28 11:08