当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - How can NSString write to a file when I have a FILE handle open for reading?

问题描述:

I have a sample iOS app in which I am trying to measure the time taken by the various file writing alternatives. While measuring the time, I noticed that NSString's writeToFile method write to the file even when I have a file handle for read on the same file that has been obtained by using fopen().

网友答案:

Well, that's easy. writeToFile creates a new file with the same name. Your file handle refers to the old file. The old file will disappear when you close the file handle; it's name already disappeared when writeToFile created a new file.

分享给朋友:
您可能感兴趣的文章:
随机阅读: