由於原來專案中的讀取記事本方法未指定編碼格式,導致讀取中文會出現亂碼。在網上查詢了一些資料,修改如下:
tchar* preadmode = l"r,ccs=utf-8";//這裡增加了css=utf-8
const int read_fullfile_buf_size = read_buf_size*4;
file* ffile = _wfopen(pfile, preadmode); // _wfopen(l"utf8.txt", l"r,ccs=utf-8") 這裡將_tfopen改為_wfopen
tchar stmpbuf[read_buf_size] = ;
int nreadlineturns = 0;
if(ffile);
tchar stmpbufprefix[read_fullfile_buf_size] = ;
tchar stmpbufextra[read_fullfile_buf_size] = ;
tchar* pdataextra = null;
_tcscat(stmpbufprefix,stmpbufextra);
pdataextra = stmpbufprefix;
C 學習記事本
template顯式例項化與隱式例項化 模板例項化都是在編譯期完成的,不管是顯式例項化還是隱式例項化。區別是隱式例項化只有到編譯器發現某個模板例項需要用到時,才會進行例項化。顯式例項化可以提前告訴模板去為某個型別進行例項化,無論後面會不會用到它。所以,顯式例項化可以將模板的宣告和定義分離,隱藏實現,...
C 實現記事本
今天我用c 編了乙個記事本,效果如下 開啟txt openfiledialog1.filter 文字檔案 txt txt if openfiledialog1.showdialog dialogresult.ok 有乙個openfiledialog1元件 儲存txt 檔案不為空才可以儲存if thi...
簡易記事本 C 窗體
using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.text using system.window...