User User - 1 year ago 112
C Question

How to set a particular byte in a file to 0 or 1?

I have a

to where I want to set the byte, from malloc. How do I set it to 1 or 0, for example?

Answer Source

Assign to your dereferenced pointer:

//This will (obviously) set it to 1
*your_pointer = 1;

//This will set it to 0
*your_pointer = 0;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download