thackit Posted November 5, 2008 Share Posted November 5, 2008 $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 More sharing options...
smashly Posted November 5, 2008 Share Posted November 5, 2008 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. Link to comment Share on other sites More sharing options...
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