ZoSTeR Posted December 16, 2007 Posted December 16, 2007 (edited) 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 December 16, 2007 by ZoSTeR
ZoSTeR Posted December 16, 2007 Author Posted December 16, 2007 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now