728x90
16진수, 10진수, 8진수의 경우
%x, %d, %o 를 통하여 쉽게 확인, 변환 할 수 있는 반면
변수의 2진값을 확인하는 방법은 제공해주고 있지 않습니다.
다음과 같이 하면 2진값을 string으로 출력 받을 수 있습니다.
#include <bitset> using namespace std; char cTemp = 0xff; string strTemp = bitset<8/*출력될 비트의 개수*/>( cTemp ).to_string(); strTemp 의 값은 "11111111"
728x90
'dev' 카테고리의 다른 글
Raspberry Pi GPIO/WiringPi Pin Number (0) | 2019.02.19 |
---|---|
mosquitto Opening ipv4 Error: ?????? (0) | 2019.02.18 |
C++ Microsecond Delay (Windows) (0) | 2017.08.04 |
IOCP & Overlapped IO (0) | 2017.07.21 |
InstallShield Serial Number Check Example (0) | 2013.08.12 |