CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Reading a specific part of a file

    Is it possible to read just a part of a file, without having to read the entire file. For example, I just need bytes 1700 trough 1800 from myProgram.exe. This is not a database file, nor a ascii file.
    Also, when the read is done, the file should be closed so other instances of the program can acces the file anywhere they want.

    This is for sending files across a network. It must be possible to send the same file at the same time to multiple receivers, even when someone requests the file when it is already beeing sent to someone else (like 70% complete)

    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  2. #2
    Join Date
    Jan 2000
    Location
    MX
    Posts
    51

    Re: Reading a specific part of a file

    haven't done it before, but maybe you can use something like this :


    dim myByte as Byte
    dim iFile as Integer

    iFile=FreeFile

    Open "myfile.dat" for bynary as #iFile

    'use seek to position at the desired address
    'use input to read the amount of bytes

    Close #iFile





    i'll give it a try, If I come up with something I'll let ya know... in the mean time, check those functions (input, seek)




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