Jump to content

Recommended Posts

Posted

$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!

Posted

You can not open a file in read and write mode at the same time.

You need to open the file for reading, then close the file after reading.

Then open the file again for writing.

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
  • Recently Browsing   0 members

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