From somewhere I got the code to write something to a file using fwrite on the current file position like this:
fwrite(SomeValue, sizeof(unsigned char), 1, outfile);
I would like to replace the "1" with a constant. I was expecting it to be one like "CUR_POS" or something like that, but did not find anything.
Can somebody help?
Thank you!
The third argument to fwrite
is not the position, as fwrite
always writes to the current position no matter what. The third argument is actually the number of items to write, with the second argument being the size of each item. Thus, if you're just writing a single block of data to a file, the second argument should be just the block's size and the third should be 1
(or vice versa).