Bulk write to a file

Hi,

I have some huge data to be written to a file. So instead of writing line by line, I want to write many a lines at a time to save time.

Each line has something of this kind

12938 12343

This is how I am doing right now.
outFile<<num1<<" "<<num2<<endl;

So instead of writing line by line I want to write many lines(say 10000) at a time. How do I do that?

I was thinking of concatening all these lines to a string and then write this string to the file. But in that case I have to write them to a temp string everytime and then concatenate. Due to which I am not gaining much. Is there any better way to do that?

Thanks
Why do you want to write all the lines at the same time?
The best solution should be having a loop and each time it gets executed you write a line
Topic archived. No new replies allowed.