Jump to content

Replace one ASCII char in a binary file?


Recommended Posts

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 by Edward Mendelson
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...