delorie.com/archives/browse.cgi | search |
From: | Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: djgpp complains about boolalpha |
Date: | Sun, 06 Feb 2000 13:03:42 +0000 |
Organization: | Customer of Planet Online |
Lines: | 34 |
Message-ID: | <naqq9sk8i9pjtq5mk7sqk939e3doftq462@4ax.com> |
References: | <87hepf$v0k AT r02n01 DOT cac DOT psu DOT edu> <03ro9sc0e7cpef036bce65r6f0nbobib1a AT 4ax DOT com> <87ikuu$e22 AT r02n01 DOT cac DOT psu DOT edu> |
NNTP-Posting-Host: | modem-248.indium.dialup.pol.co.uk |
Mime-Version: | 1.0 |
X-Trace: | news6.svr.pol.co.uk 949842650 16833 62.136.40.248 (6 Feb 2000 13:10:50 GMT) |
NNTP-Posting-Date: | 6 Feb 2000 13:10:50 GMT |
X-Complaints-To: | abuse AT theplanet DOT net |
X-Newsreader: | Forte Agent 1.7/32.534 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
"Thanhvu Nguyen" <txn131 AT psu DOT edu> wrote: > ansi/iso standard provides data type bool .. and boolalpha will print out > either true or false. > no header needed .. it was compiled fine under vc++ 6 > > e.g > bool boolean = false; > cout << boolalpha << boolean << endl; > > this will print "false" According to C++PL3, boolalpha is declared in <iomanip> Unfortunately, this does not seem to be the case with DJGPP. ;-( I have found the formatting flag _IO_BOOLALPHA in libio.h but setting this flag manually with cout.setf() has no effect so I guess that it is not yet fully implemented in GCC. For now, probably the best that can be acheived is to define a conversion function: #include <iostream> using namespace std; const char *bool_to_alpha(bool b){return(b?"true":"false");} int main() { bool boolean = false; cout << bool_to_alpha(boolean) << endl; return 0; }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |