vb.net replace last part or file

Discussion in 'Mixed Languages' started by Stannieman, May 26, 2010.

  1. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,818
    90
    Hi,
    I want to use vb.net to replace the last x bytes of a large file.
    The file is too large to completelly load in memmory, change it and saving it again.
    The resulting file will be the same size as the source file.
    I already read a lot about file mapping etc but I don't get it all (vb beginner).
    Can anyone please explain how to do this?

    Tanks in advance
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,818
    90
    #2 Stannieman, May 30, 2010
    Last edited by a moderator: Apr 20, 2017
    (OP)
    OK fixed, thought filestream reads whole file in ram but actually it doesn't.
    But now I have another problem.
    Code:
    try
    process.start(shell("sfx.exe /extract:Directory /quiet")).waitforexit
    catch error as exception
    'do something
    end try
    The sfx is actually an sfx cab office installer, the shell command is right but in jumps to the eception. When I look at the extract directory however, the sfx is still bussy extracting. So why doesn't the program wait for it to complete and thinks there's an error while there isn't one?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,818
    90
    #3 Stannieman, May 30, 2010
    Last edited by a moderator: Apr 20, 2017
    (OP)
    OK fixed, thought filestream reads whole file in ram but actually it doesn't.
    But now I have nother problem.
    Code:
    try
    process.start(shell("sfx.exe /extract:Directory /quiet")).waitforexit
    catch error as exception
    'do something
    end try
    The sfx is actually an sfx cab office installer, the shell command is right but in jumps to the eception. When I look at the extract directory however, the sfx is still bussy extracting. So why doesn't the program wait for it to complete and thinks there's an error while there isn't one?

    EDIT: Sorry guys, also solved, didn't notice the shell command also has a wait option. I removed the process.start and used that one and its' all ok now.

    Thread can be locked
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...