microsoft.win32.openfiledialog dialog =
new microsoft.win32.openfiledialog();
dialog.filter = "文字檔案|*.txt";
if (dialog.showdialog() == true)
//判斷檔案開啟
string path1 = dialog.filename;
// 另外,用記事本程式視窗開啟檔案
// path1 = dialog.safefilename.tostring();
streamreader sr = new streamreader(path1);
// 申請乙個streamreader空間
//在textbox框的開頭新增換行和製表符// 把文字的內容輸出到名為:"textboxx" 的textbox框中;
}
c 讀取 寫入 文字檔案
include include 讀寫檔案的標頭檔案 include using namespace std 1 文字檔案 寫檔案 1 包含標頭檔案 include 2 建立流物件 ofstream ofs 3 指定路徑和開啟方式 ofs.open 路徑,開啟方式 開啟方式 ios in 讀檔案開啟 ...
讀取和寫入文字檔案
read a text file 的這篇文章部分描述如何使用streamreader類來讀取文字的檔案。write a text file example 1 和 write a text file example 2 在各節說明了如何使用streamwriter類來向檔案寫入文字。讀取文字檔案 若...
c 文字檔案寫入
private void 跟蹤記錄 string 輸出內容 private void 修改日記 string 輸出內容 filestream 建立只寫檔案 檔案.openwrite 建立只寫檔案.close streamwriter 寫入 new streamwriter 儲存檔名,true 以可以...