I have a binary file which I must rewrite out to the local disk. In the
process of doing that, there are some 30 character strings I must search and
replace with a different corresponding string to each of those 30 character
strings. Each of these strings is between 10 and 500 bytes long.
Can someone please tell me what htey think the most efficient and effective
way to do this might be? TIA, Ike
> I have a binary file which I must rewrite out to the local disk. In the
> process of doing that, there are some 30 character strings I must search and
> replace with a different corresponding string to each of those 30 character
> strings. Each of these strings is between 10 and 500 bytes long.
> Can someone please tell me what htey think the most efficient and effective
> way to do this might be? TIA, Ike
Hey Ike! I guess all files are binary, or hex or octal, or something,
aren't
they? Worse yet, the characters could be any language -- did you think of
that?
Anyway, you might want to read in at least 500 bytes at a time, into a
buffer
of at least 1,000 bytes. Then you search and replace as needed. The only
problem I see is if the "local disk" is full and you can't write your
results until you've deleted the previously read portions of the file.
By the way, how are you doing on this? Do you have any code that you
could
share with the folks here? Knowing whether your problem is I/O, i18n, or
proprietary/encoded data, or something else might help readers of the
newsgroup to help you.