Date: Thu, 27 Jan 1994 09:13:06 -0500 (EST) From: Edwin L Phillips Jr Subject: Re: form syntax ... (fwd) To: Hassan Saleh Cc: djgpp AT sun DOT soe DOT clarkson DOT edu On Wed, 26 Jan 1994, Hassan Saleh wrote: > ---------- Forwarded message ---------- > Date: Thu, 20 Jan 1994 18:17:34 -0800 (PST) > From: Hassan Saleh > To: djgpp AT sun DOT soe DOT clarkson DOT edu > Subject: form syntax ... > > Please can someone point out to me what is wrong with the following > program segment ? It won't compile with djgpp. > > > ========================================================== > #include "iostream.h" > #include "string.h" > > main() > { > int index; > float distance; > > index = -23; > distance = 12.345; > > cout << "The value of distance is " << form("%12.4f\n",distance); > cout << form("Hello world!") << "\n"; This may be the ^^^^^^^^^^^^^ problem. In iostream.h, form is prototyped as: ostream& form(const char *format ...); which may mean form should require at least 2 args. Does anyone have the spec on this? I'm used to seeing things like form(char *f, ...) instead of form(char *f ...). It seems like it should be ok as written, but... Also, what is the output of the compiler. Where is it balking? > > cout << "Input a decimal value --> "; > cin >> index; > cout << "The hex value of the input is " << index << "\n"; > } > > > > > > Ed /***************************************************************************/ /* Ed Phillips flaregun AT brahms DOT udel DOT edu University of Delaware */ /* Jr Systems Programmer (302) 831-6082 NSS/Software Systems */ /***************************************************************************/