I'm new to programming and I just learned and am playing around with fstream and noticed the writing speed is approximately 300KBps. Here is my basic program:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int countX = 0;
int countY = 0;
ofstream output;
output.open("output.txt");
for (int i = 0; i < 1000; i++)
{
for (int y = 0; y < 1000; y++)
{
countX++;
output << 1; //Record output.txt 1 byte of information
//300KBps
}
}
output << endl << countX;
output.close();
return 0;
}
Now I'm wondering if there is a way to speed this process? (Except the obvious better hardware)E.g. Devoting more processing power to program. My computer utilization shows about 10-14%.