0
int 입력 바이너리를 인쇄하는 함수가 있습니다. 완벽하게C++ 16 진수 Int Stringstream 사용하여
int num = 0;
stringstream << "0xabcd123";
stringstream >> num; //num becomes the decimal representation of the above hex.
outputBinary(num);
작품 : 나는 문자열 형태의 진수가있을 때
, 내가 사용하는 함수를 호출합니다. 그러나
에 "NUM"16 진수 문자열로 변환 할 때
int num = 0;
stringstream << "0xabcd1234"; //fully filled hex value.
stringstream >> num; //num remains at 0.
outputBinary(num);
그것이 완전히 채워진 16 진수 값 원인 이제 stringstream 오버 플로우 것을 할 수 있을까요?
두 개의 코드 스 니펫은 동일합니다 (그리고 아마도'outputBinary' 두 개를 보여줄 수 없습니다) – quantdev
시도 됨'unsigned num; stringstream >> num;'? –