Hi, 

Is there a way in C++ ( using the iostream.h ) or in C ( using the 
stdio.h and the like ) to control precisely how 
data gets saved to a file. What I mean by this is, can I control exactly 
at which offset within the file my data blocks will go.

I need that, because I wrote a client that receives a file from a server. 
In my implementation I am using UDP, so there is no guarantee about the 
order in which the packets that constitute that file arrive. Every packet 
though is numbered and its size (except for the last packet) is known.
 
That lets me calculate exactly its starting and ending offset position 
with in the file.  

It would be pretty neat if I could save the file to my disk, right away 
as its packets keep on coming, based on the above calculation. I am sure 
that is possible; unfortunately I don't know how to do it.

I did some experimentation with fseek, but all I got was segmentation 
faults. :(

Any help would be appreciated,
mich

Reply via email to