CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    26

    Red face Write file and read file on the remote computer

    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.

  2. #2
    Join Date
    Jan 2005
    Location
    Gothenburg, Sweden
    Posts
    134

    Re: Write file and read file on the remote computer

    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
    Code:
    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
    Code:
    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 */
    If you try and take a cat apart to see how it works,
    the first thing you'll have on your hands is a nonworking cat

  3. #3
    Join Date
    Mar 2005
    Posts
    26

    Wink Re: Write file and read file on the remote computer

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured