Click to See Complete Forum and Search --> : Write file and read file on the remote computer


truongptr
March 8th, 2005, 02:51 AM
I am bulding a application that download and upload data from any server to local computer and from local computer to the server. but I have a problem, I have not any resolve. During I am uploading and the connection is disconnected (an example) At the moment the file is not finished (50%), I wants to continue at the later time uploading(from 50%) (I don't wants to the uploading begin at 0%). Any body can help me, please.
thanks very much.

svenhag
March 8th, 2005, 03:32 AM
You probably have to implement some sort of resume message that tells the client/server where it should start reading the file.

The side that should be receiving the file

FILE *f = fopen("file_to_recv", "rw");
long off;

fseek(f, 0, SEEK_END);
off = ftell(f);

/* tell offset to other side */

The side that should send the file

FILE *f = fopen("file_to_send", "r");
long off; /* = get offset from other side */

fseek(f, off, SEEK_SET);

/* start reading from file and send it */

truongptr
March 9th, 2005, 07:37 PM
Thank you Svenhag for your idea, but I have difficulty with reading and writing file on the Server. I do not know what class I can use.