3、 將字符串轉換為其他的數據類型
3.1 “字符串”轉換為“短整型”
字符串轉換為短整型,系統提供了函數atoi()實現這個功能,其函數原型如下:
int atoi(const char *string);
其中,參數const char *string為要轉換的字符串,返回值為轉換的結果。
3.2 “字符串”轉換為“長整型”
函數原型:
long atol(const char *string)
3.3 字符串轉換為雙精度類型
函數原型:
double atof(const char* string)
如果還想獲得更多關于《Visual C++代碼參考與技巧大全》的內容,可點擊下面網址,
http://www.shnenglu.com/kangnixi/archive/2010/01/13/105591.html