PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   七嘴八舌異言堂 (https://www.pcdvd.com.tw/forumdisplay.php?f=12)
-   -   C 語言問題請教~字串轉整數 (https://www.pcdvd.com.tw/showthread.php?t=1094344)

rickyliu0222 2015-12-15 05:22 PM

C 語言問題請教~字串轉整數
 
強者們

請問有人懂如何把字串的AC (二個BYTES),轉成INT 變數的0XAC。

有簡單的函數可以用嗎?

謝謝~

aei 2015-12-15 05:30 PM

引用:
作者rickyliu0222
強者們

請問有人懂如何把字串的AC (二個BYTES),轉成INT 變數的0XAC。

有簡單的函數可以用嗎?

謝謝~


http://pydoing.blogspot.tw/2010/07/c-atoi.html
??
是你要的嗎? :)

dou0228 2015-12-15 05:34 PM

http://stackoverflow.com/questions/...entation-string

X_Tiger 2015-12-15 05:35 PM

引用:
作者rickyliu0222
強者們

請問有人懂如何把字串的AC (二個BYTES),轉成INT 變數的0XAC。

有簡單的函數可以用嗎?

謝謝~


const char *hexstr = "0x0abcdef";
int hexnum = (int)strtol(hexstr, NULL, 0);


所有的時間均為GMT +8。 現在的時間是05:29 AM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。