need help with file manipulation

I've been able to open and write data to files but I need to know how to search a file for a hex string and replace it.

A "poor man's" method could be to use
two file descriptors (1 read fd and 1 write fd)
on the file and then use
getc() and examine the value of the character
returned (and subsequent character values) to
match the string in question. Once you've found
it, you can then "seek()" to the start of the
pattern and write the new pattern assuming you
are writing the same number of bytes to replace
the old pattern. If not, then you will have to
write to a new file (maybe a tmp file) and be
sure to write out all non matching data to the
new file. You can then replace the old file
with the new one ( see: unlink(), link() ).

thanks it worked great