I am having trouble setting the output format while using a pointer to a Filestream:

struct statLine{
int id;
int primary_type;
int secondary_type;
double period;
double epochnumber;
int savedextremenumber;
}statLine;

void printStatLine(ofstream *FSOptr)
{
        FSOptr->precision(7);
        *FSOptr << statLine.id << " " << statLine.primary_type << " " <<statLine.secondary_type << " ";
        *FSOptr << statLine.period << " ";
        *FSOptr << statLine.epochnumber << " " << statLine.savedextremenumber << endl;
}

The printing works ok, but I can't seem to make the formatting (precision(7)) stick. Any suggestions?

do you mean setprecision()?
yer gonna need to insert it into the stream before your data likeso

struct statLine{
int id;
int primary_type;
int secondary_type;
double period;
double epochnumber;
int savedextremenumber;
}statLine;

void printStatLine(ofstream *FSOptr)
{
        //FSOptr->precision(7);
        *FSOptr << statLine.id << " " << statLine.primary_type << " " <<statLine.secondary_type << " ";
        *FSOptr << [B]setprecision(7[/B]) << statLine.period << " ";
        *FSOptr << [B]setprecision(7) [/B] << statLine.epochnumber << " " << statLine.savedextremenumber << endl;
}

dont forget to add <iomanip> up top

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.