Lines: 51 X-Admin: news AT aol DOT com From: mmarkhinchcliffe AT aol DOT com (MMarkHinchcliffe) Newsgroups: comp.os.msdos.djgpp Date: 27 Aug 2003 09:23:31 GMT Organization: AOL, http://www.aol.co.uk Subject: setf problem Message-ID: <20030827052331.16681.00000001@mb-m02.aol.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'd be very grateful for some help with the following problem In the code below the line os.setf( oldflags, ios::basefield); causes a compilation error: invalid conversion from 'long int' to 'std::_Ios_Fmtflags' initializing argument 1 of 'std::_Ios_Fmtflags' std::ios_base::setf(std::_Ios_Fmtflags, std::_Ios_Fmtflags)' I've tried changing oldflags to long, unsigned long, int, unsigned int without success. In Microsoft Visual C++ 6.0 the Ios.h declares: inline long setf(long _f,long _m); inline long setf(long _l); Presumably in djgpp setf similarly returns & takes parameters of type 'long' I can't understand why the compiler objects to this. Mark Hinchcliffe /* * friend output operator * Parameters: * os - output stream to write to * bigi - Big_int to print value of * Return value: * reference to os */ ostream & operator << ( ostream &os, const Big_int & bigi ) { long oldflags = os.setf( ios::hex, ios::basefield); char old_fill = os.fill('0'); bool leading_zero = true; for( int i = bigi.size_ - 1; i >= 0; i-- ) { if ( ! leading_zero ) os.width(8); if ( bigi.number_[i] != 0) leading_zero = false; else if (i != 0 && leading_zero) continue; os << bigi.number_[i]; } os.fill(old_fill); os.setf( oldflags, ios::basefield); return os; }