delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/08/03:04:11.1

Message-ID: <3BC14C40.3E3544CF@falconsoft.be>
Date: Mon, 08 Oct 2001 08:48:32 +0200
From: Tim Van Holder <tim DOT vanholder AT falconsoft DOT be>
Organization: Anubex (www.anubex.com)
X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.2.16-3 i686)
X-Accept-Language: en, nl-BE, nl
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: iostream function "form" in DJGPP V3
References: <9ppeci$gjv$02$1 AT news DOT t-online DOT com>
Lines: 34
NNTP-Posting-Host: 194.78.64.238
X-Trace: 1002523771 reader0.news.skynet.be 21080 194.78.64.238
X-Complaints-To: abuse AT skynet DOT be
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Günter R" wrote:
> 
> in V2 of DJGPP this worked as expected:
> 
> #include <iostream.h>
> cout.form ("%8.3f\n", a); ....
> 
> in V3 it does not work anymore.
> The error message is:
> Error: "form" undeclared ....
> 
> I'm working with DJGPP V3.0 and RHIDE 1.4.9
> 
> Thanx

Note: it's GCC v3.0, NOT DJGPP v3.0.
DJGPP is the entire environment, NOT the compiler.

As for form(), it was a GNU extension that has now
been removed for ANSI compliance.  You'll have to
rewrite your output using C++ syntax:

// Note: no .h! - iostream.h is not ANSI and will likely
// be removed in future versions of gcc
#include <iostream>
#include <iomanip>
...
cout << setwidth(8) << setprecision(3) << a << endl;

or use a buffer and sprintf:

char outbuf[16] = { "" );
sprintf (outbuf, "%8.3f", a);
cout << outbuf << endl;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019