Jump to content
Sign in to follow this  
ZoSTeR

StdOutRead corrupts binary data

Recommended Posts

I'm trying to read binary data from StdOut and write it to a file but it gets corrupted.

Maybe im doing something wrong or StdOutRead isn't supposed to work with binary input.

I tried various combinations with Binary() but without success.

Here's a sample:

#include <Constants.au3>

Dim $proc_Unrar

$fh_File01 = FileOpen("D:\OUT_STD.bin",18)

$proc_Unrar = Run("Unrar.exe p -inul D:\BinaryData.rar", "", "", $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $buffer = StdoutRead($proc_Unrar)
    $err_StdoutRead = @error
    If $err_StdoutRead Then ExitLoop
    FileWrite($fh_File01,$buffer)
Wend

FileClose($fh_File01)

MsgBox(0, "Debug", "Exiting...")
Edited by ZoSTeR

Share this post


Link to post
Share on other sites

Ok the actual problem is the 0x00 hex value that doesn't get passed on.

Only thing i could think of is this:

$buffer = StdoutRead($proc_Unrar,1)
If $buffer = "" Then $buffer = Chr(0)

Well this isn't elegant or effective at all. Any other suggestions?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...