Jump to content

Redirecting Stdout with 8-bit characters


 Share

Recommended Posts

Here is script _m.au3:

Local $c = Chr(166)
ConsoleWrite($c&'cat'&$c&@CRLF)

When run via F5 in SciTE, the Output pane shows ¦cat¦

Here is _n.au3:

#include <AutoItConstants.au3>

Local $tracedFilspc = StringReplace( @ScriptFullPath,'_n.au3','_m.au3')
Local $logFilspc = StringReplace($tracedFilspc,'.au3','.log')

Local $nPID = Run('"'&@AutoItExe&'" "'&$tracedFilspc&'"','',@SW_HIDE,$STDOUT_CHILD)
Local $logFilspc = StringReplace($tracedFilspc,'.au3','.log')
Local $fd = -1
While True
    If $fd=-1 Then $fd = FileOpen($logFilspc,2) ; overwrite
    Local $rec = StdoutRead($nPID)
    If @error Then
        ExitLoop
    EndIf
    FileWrite($fd,$rec)
    FileClose($fd)
    $fd = FileOpen($logFilspc,1)    ; append
WEnd
If $fd<>-1 Then FileClose($fd)

(This code is more complicated than is needed here; the real code allows the user to stop the Run by pressing Esc.)

The log file contains ¦cat¦

Why the difference?

I have tried it with Chr(135). The results are ‡cat‡ and ‡cat‡ ; even weirder!

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...