Jump to content

How FileWrite write Binary Data into file


thackit
 Share

Recommended Posts

$file = FileOpen("tmp.txt", 18)         ;binary mode, I try 17 too
If $file = -1 Then
    MsgBox(0, "error", "can't open file.")
    Exit
EndIf

$chars = FileRead($file)                    ;$char's content is like 0x1234....
$test = StringReplace($chars, "B2CBB5A5", "D4ADB0E6", 1)           ;replace once use a specified string
FileWrite($file, $test)                 ;can't write, and the tmp.txt is empty now.
FileClose($file)

This is my test code above. Why filewrite can't work? And HowTO?

I also try $test = StringTrimLeft($chars, 2), but it can't work too.

PLS HELP!

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...