publicclassfileaccessextendsactivitycatch(exception e)
} /**
* //讀檔案在./data/data/包名/files/下面
* * @param filename
* @return
*/publicstring readfiledata(string filename)catch(exception e)
returnres;
} /**
* 寫, 讀sdcard目錄上的檔案,要用fileoutputstream, 不能用openfileoutput
* 不同點:openfileoutput是在raw裡編譯過的,fileoutputstream是任何檔案都可以
* @param filename
* @param message
*/// 寫在/mnt/sdcard/目錄下面的檔案
publicvoidwritefilesdcard(string filename, string message)
catch(exception e)
} // 讀在/mnt/sdcard/目錄下面的檔案
publicstring readfilesdcard(string filename)
catch(exception e)
returnres;
} /**
* 二、從resource中的raw資料夾中獲取檔案並讀取資料(資源檔案只能讀不能寫)
* * @param fileinraw
* @return
*/publicstring readfromraw(intfileinraw)catch(exception e)
returnres;
} /**
* 三、從asset中獲取檔案並讀取資料(資源檔案只能讀不能寫)
* * @param filename
* @return
*/publicstring readfromasset(string filename)catch(exception e)
returnres;
}
VC讀取TXT檔案資料(1)
一 運用cstdiofile readstring cstdiofile f your file name cstring str while f.readstring str 二 程式實現 假設你已有了名為ts.txt的檔案在你的工程目錄下 o file.getposition 記錄上次的結果 讀...
VC讀取TXT檔案資料(1)
一 運用cstdiofile readstring cstdiofile f your file name cstring str while f.readstring str 二 程式實現 假設你已有了名為ts.txt的檔案在你的工程目錄下 o file.getposition 記錄上次的結果 讀...
mysql資料庫匯入txt檔案資料
把txt檔案匯入到mysql資料庫中,選用的是mysql中的load data 語法。load data local infile d test.txt into table test fields terminated by enclosed by lines terminated by n ig...