Formatting output to a file.
Hi,
I am trying to format data in a flat file in a particular format. The following are the steps.
STEP 1:
Data elements in the code.
Code:
string FixedValue;
string Milliseconds;
string Symbol;
string LastTradePrice;
string AccumulatedVolumeTrading;
string BestBidPrice;
string BestAskPrice;
string BestBidSize;
string BestAskSize;
string DataBlock;
STEP 2
Convert data type of type double, int and Timestamp into String defined in the data elements.
STEP 3
create a input file stream and write the output into the file like the following.
Code:
ofstream data_file ("data_file.dat");
data_file << symbol + "," + BestBidPrice + "," + BestBidSize << endl;
My question is how to convert double, int and Timestamp to string format efficiently and write it to the file?
Regards,