P
Paolo
Hi!
I'm writing an application that receives data from internet. I usually
receive big files, few hundred MB to Gb and the packets I receive could
be not in a correct order. I though I could send a packet that specify
the lenght of the file before any other packet. The receiver creates
this file, with the specified dimension and then using ofstream's write
and seekp I would write the packets in the correct position.
My problem is, how can I create a file with a specific dimension? Do I
have to use something like
while(lenght < the_lenght_i_want)
write(new char[1000], 1000)
???
Then close the file and open it every time I receive a packet? I can't
use a buffer, at least not a buffer that contains the whole file!
Any suggestion?
Thank you!
I'm writing an application that receives data from internet. I usually
receive big files, few hundred MB to Gb and the packets I receive could
be not in a correct order. I though I could send a packet that specify
the lenght of the file before any other packet. The receiver creates
this file, with the specified dimension and then using ofstream's write
and seekp I would write the packets in the correct position.
My problem is, how can I create a file with a specific dimension? Do I
have to use something like
while(lenght < the_lenght_i_want)
write(new char[1000], 1000)
???
Then close the file and open it every time I receive a packet? I can't
use a buffer, at least not a buffer that contains the whole file!
Any suggestion?
Thank you!