Mail Archives: djgpp/1992/11/06/03:25:02
Back to the problem I was having with "cout << hex << number;", I tracked
down the bug to iostream.cc, so presumably it was an inherited bug from
libg++. If it is, please advise and I'll forward this there (I don't have
the full libg++ sources handy for comparison).
This is the diff which corrects the problem. As you can see, ios::showbase
was always in effect.
*** iostream.cc Fri Nov 6 23:38:32 1992
--- old/iostream.cc Fri Nov 6 23:36:52 1992
***************
*** 334,350 ****
sprintf(buf, "%lu", val);
else if (stream.flags() & ios::oct) { // Oct
sprintf(buf, "%lo", val);
! if (stream.flags() & ios::showbase)
show_base = "0", show_base_len = 1;
}
else if (stream.flags() & ios::uppercase) {// Hex
sprintf(buf, "%lX", val);
! if (stream.flags() & ios::showbase)
show_base = "0X", show_base_len = 2;
}
else { // Hex
sprintf(buf, "%lx", val);
! if (stream.flags() & ios::showbase)
show_base = "0x", show_base_len = 2;
}
int buf_len = strlen(buf);
--- 334,350 ----
sprintf(buf, "%lu", val);
else if (stream.flags() & ios::oct) { // Oct
sprintf(buf, "%lo", val);
! if (stream.flags() && ios::showbase)
show_base = "0", show_base_len = 1;
}
else if (stream.flags() & ios::uppercase) {// Hex
sprintf(buf, "%lX", val);
! if (stream.flags() && ios::showbase)
show_base = "0X", show_base_len = 2;
}
else { // Hex
sprintf(buf, "%lx", val);
! if (stream.flags() && ios::showbase)
show_base = "0x", show_base_len = 2;
}
int buf_len = strlen(buf);
Smoke me a kipper, Skipper - I'll be back for breakfast! - "Ace" Rimmer
david AT csource DOT oz DOT au 3:632/348 AT fidonet 58:4100/1 AT intlnet 199:4242/5 AT rainbownet
Unique Computing P/L / Communications+LAN Specialists / Public Access USENET
PO Box 352, Doveton, VIC, Aust 3144. Data/BBS: +61-3-792-3507 / +61-3-794-7949
- Raw text -