binary write to file problem in mode r+b
I created a class which should creates new binary file (called 4.ip) in the case that the file does not exist. Method reset() does the job. Then I try to add some numbers from Ip to the file. I try to use binary mode but It looks like it corrupts the file. First value 0E is written correctly. I have marked the BOM which was created in the reset method (idk if is this right when it should be binary file.
To see the above, uncomment the die(); on line 413. Then to see the bellow, comment it back.
When I try to write the second value (line 415), the file looks corrupted, and all the 0000 disappear.
error on second fwrite
This is the source code
please see the lines 412-418.
Please help because I really cannot find out solution, and I am lost. Trying to solve this few days.
$scanIPs = new Scan_ips;
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)