Sunday, July 7, 2013

std::setw() Not Working?

Newsgroup: comp.lang.c++

Subject: std::setw() Not Working?

From: mrc2323@...

Date: Sun, 7 Jul 2013 11:10:48 -0700





The following code doesn't work as I understand it should.

Specifically, the "setw" takes effect for only the data which

immediately follows it, whereas I thought it would work on all data

which follows until another "setw" is encountered. What am I missing?

TIA



int IFns = 976, IPts = 130, ITms = 978;

FILE *fv = fopen("oldfile.sav", "wt");

ofstream saveFile;

saveFile.open("savefile.sav");

fprintf(fv, "%6d%6d%6d\n", IFns, IPts, ITms);

saveFile << setw(6) << IFns << IPts << ITms << endl;







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?37430-std-setw()-Not-Working&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment