emendelson Posted October 8, 2010 Share Posted October 8, 2010 (edited) I've been studying various posts here, and studying the help file, and this problem is still beyond me. For a script I'm writing, I want to replace one character in a binary file; the character I want to replace will be an alphabetical character, and I will want to replace it with another alphabetical character. It's always in the same position in the file (51h). I do not need to read the file to learn what the original character is; I only need to insert the replacement character, for example "K" or "V" or whatever letter happens to be needed. (Details: the file is a macro file created by the old WordPerfect for DOS 5.1 program; I'm trying to insert the current drive letter into the macro, which will be used by WordPerfect.) I think I need to use FileOpen, FileSetPos, and FileWrite, but I can't see exactly how to do this. Any advice or sample code would be very welcome. Thank you. Edited October 8, 2010 by Edward Mendelson Link to comment Share on other sites More sharing options...
emendelson Posted October 8, 2010 Author Share Posted October 8, 2010 Figured out for myself - sorry to waste bandwidth: $m = FileOpen($myfile, 17) FileSetPos($m, 81, $FILE_BEGIN) FileWrite($m, "X") FileClose($m) 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