If you use fseek
to go past the end of a file and then append data after the EOF, would the data in between the EOF and what you wrote be undefined?
For example in the code below, would there be 10 bytes of undefined data in the written file because of randomLengthPastEOF
?
unsigned char *someText= "ExampleText";
int length = 11;
int randomLengthPastEOF = 10;
FILE *output = fopen("/Example/FilePath", "wb");
fseek(input, randomLengthPastEOF ,SEEK_END);
fwrite(someText, 1, length, output);
I can't find a reference any where to what might happen so I assume it is undefined.
undefined data
? – Sourav Ghosh Jul 21 '16 at 7:14