How can you create a large file in iOS quickly

后端 未结 3 1986
误落风尘
误落风尘 2021-01-16 08:12

I need to be able to create a large \"dummy\" file (around 1 GB) quickly. I am currently looping over a byte array and appending it to the file, but this results in may sepa

3条回答
  •  一生所求
    2021-01-16 09:00

    You can check this answer. It says that you can lseek() past the end of file (EOF) then write something. The gap between the initial end of file and the bytes you wrote will return 0's if queried.

提交回复
热议问题