Write a binary file containing zeros to a Linux file system
Clash Royale CLAN TAG #URR8PPP Write a binary file containing zeros to a Linux file system I have a large block of memory in my C program that contains zeros in the middle. I want to save this to disk without converting the values to ASCII. Will writing zeros to a file stream cause a false-negative EOF when I try to read from that file later? Example: int x[1024] = {1, 2, 3, 4, 0, 0, 0, 0, 3}; // write x to disk in myfile.bin Thanks in advance! Not if you use fwrite to write the memory block to a binary file. Next, 0 is not an EOF indicator. Except in some old text file formats (which used 0x1A ), there is no EOF indicator present as part of the file. – Weather Vane 6 mins ago fwrite 0 0x1A 1 Answer 1 ...