Create a certain size file and filled with no data on iOS
问题 I'm developing an iphone app, I need to create a certain size file on filesystem and filled with NO data first, then seek to a offset and write data when get data from somewhere else How can I do it? 回答1: The lseek BSD function is explicitly capable of that. man lseek : The lseek() function allows the file offset to be set beyond the end of the existing end-of-file of the file. If data is later written at this point, subsequent reads of the data in the gap return bytes of zeros (until data is