M
Mike Copeland
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;
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;