Jump to content

Fwrite


alphabeta12
 Share

Recommended Posts

I am working with files opened by fopen binary. Immediately these files are changed to hex via bin2hex. From there I do some processing of the hex. I have no clue as to how I should write the changes to a new file from that point. Can I get any help with writing hex to a file?The files that I use are pretty much unknown (they are kinda sorta images), and all that you can do to them is edit the hex, and I use PHP to do that.

Link to comment
Share on other sites

You can use the pack function to turn an ASCII hex string into binary data, and then use fwrite to write it back to the file. Make sure to use the b flag with fopen to open the file in binary mode.

Edited by justsomeguy
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

×
×
  • Create New...