C 建立目錄

2022-04-29 04:33:13 字數 1030 閱讀 5546

c#建立目錄

if (!directory.exists(strpatj+"

\\temp"))

directory.createdirectory(strpatj + "

\\temp");

c#在目錄下建立檔案

streamreader sr = new streamreader(filestrem, system.text.encoding.getencoding("

gb2312

")); //

讀取這個流

using (streamwriter sw = new streamwriter(strpatj + "

\\temp\\

" + "

temp.csv"))

//帶編碼方式寫入

using (streamwriter sw = new streamwriter(strpatj + "

\\temp\\

" + "

temp.csv

", false, encoding.getencoding("

gb2312

")))

//在讀取該檔案,返回乙個stream.

streamreader sr1 = new streamreader(strpatj + "

\\temp\\

" + "

temp.csv

", system.text.encoding.getencoding("

gb2312

")); //

讀取這個流

filestrem =sr1.basestream;

//未測試

using (filestream fsw = new filestream(strpatj + "

\\temp\\

" + "

temp.csv

", filemode.create, fileaccess.write)) //

開啟檔案,用於只寫??

C 建立多級目錄

建立多級目錄 bool makedirectory cstring dd m arr.removeall for x1 0 x1 dd.getlength x1 if x1 dd.getlength 1 m arr.add tem findclose ffile for x1 1 x1 m arr....

C 建立多級目錄

win32中提供的建立目錄的api函式 createdirectory 只能建立單層目錄,下面提供乙個建立多級目錄的方法 bool utility createmultipledirectory const cstring szpath std vectorvpath 存放每一層目錄字串 cstri...

c 建立多級目錄

c 建立多級目錄 自己寫的建立多級目錄函式 npszpath 目錄字串,呼叫方法如下 tchar lcreate l test test1 test2 createmultipledir lcreate bool createmultipledir tchar npszpath wcscpy s l...