所謂檔案操作,就是對資料流的讀寫操作
可以分為面向位元組(二進位制位元組流)的檔案讀寫,面向字元的檔案讀寫
對輸入的字元,轉換資料型別
預設的資料型別就是字元型
integer.valueof(line).intvale();
float.valueof(line).intvale();
double.valueof(line).intvale();
bufferreader br = new bufferreader(inputstreamreader(system.in));
檔案操作
file file = new file(args[0]);
file.getpath(); file.canread(); file.getname();
oldfile.renameto(newfile);
args[0].touppercase().equals"rename";
重新複習 string stringbuffer
new stringbuffer(「hello」);
stringbuffer.tostring();
尚學堂講解的太好了,inputstreamreader. outputstreamwriter是最基本的資料流,是直接對檔案進行操作的,而bufferedreader, bufferwriter 是套在inpustreamreader outputstreamwriter上進行操作的,
位元組流 bufferedinputstream, bufferoutputstream
##注意的是,字元流與位元組流一定要分清楚
有了檔案io開啟,字元流,位元組流的處理,再加上型別轉化,最基本的操作算是介紹完了
QT學習之檔案操作
void writedatatofile const long data qtextstream outdata file outdata data n file.close 基本用法 qfile類是乙個操作檔案的輸入 輸出裝置。qfile是用來讀寫二進位制檔案和文字檔案的輸入 輸出裝置。qfile...
python學習之檔案操作
在python中,操作檔案和目錄的函式一部分放在os模組中,一部分放在os.path模組中。os.listdir 返回path指定的資料夾包含的檔案或資料夾的名字的列表 os.getcwd 返回當前工作目錄 os.chdir 改變當前工作目錄 os.mkdir 建立資料夾 os.makedirs 遞...
NodeJS學習之檔案操作
js語言自身只有字串資料型別,沒有二進位制資料型別,因此nodejs提供了乙個與string對等的全域性建構函式buffer來提供對二進位制資料的操作。除了可以讀取檔案得到buffer的例項外,還能夠直接構造,例如 var bin new buffer 0x68,0x65,0x6c,0x6c,0x6...