setlocale()函式是用來配置地域資訊的,原本以為這個也是windows函式,結果居然是c++的標準函式,其標頭檔案為,按照一般的原則,所有原本c的函式被移植到c++標準庫中時,是按照去掉後面的.h,前面加上c這樣的原則。舉例:變成,所以我猜也是這樣,但是沒有繼續去確認。(從示例2上看,猜想是正確的)
測試程式1:
#include #include using namespace std;根據你系統地域設定的不同,你得到的結果也不同,我這裡執行得到的結果為:void
sr_set_locale (void)
int main()
locale is chinese_people's republic of china.936
測試程式2:
/* setlocale example */輸出結果為:#include #include #include int main ()
while (!twice++);
return 0;
}
locale is: c date is: 05/06/10 20:51:14 currency symbol is: - locale is: chinese_people's republic of china.936 date is: 2010-5-6 20:51:14 currency symbol is: ¥ -
setlocale同mbstowcs函式的關係
setlocale同mbstowcs函式的關係 程式中,如果要將ascii碼字串轉換為寬字元 unicode 可以利用標準c的mbstowcs函式。然而,這段 在處理含有漢字的字串時就會出現問題。然而,這段 在處理含有漢字的字串時就會出現問題。比如將 wchar t pwchello l hi 替換...
VBS中的SetLocale函式到底有什麼用?
vbs文件中對setlocale函式的描述 設定全球區域設定,並返回以前的區域設定。乙個 locale 是使用者參考資訊集合,與使用者的語言 國家 地區和文化傳統有關。該 locale 決定鍵盤布局 字www.cppcns.com母排序順序和日期 時間 數字與貨幣格式。簡單的說,就是vbs中的一些函...
python函式測試 python測試函式的方法
1.測試函式 python測試函式是否正確,一般使用的是模組unittest,需要建立乙個類,這個類的名字隨便取,最好是以test開頭,但是這個類必須繼承unittest.testcase類。例項11.1 我們先建立了city functions.py檔案,他的作用是定義乙個函式,顯示城市和國家名字...