Using the fopen function in an iOS system

Source: Internet
Author: User

These days in the application of the use of the OpenSSL codec in the use of fopen open files cannot get file, resulting in crash, and finally resolved, the following is the record:


Because the application of the bottom part of the code is written in C, here to open a file to read the data, the first time to create a file in the objective-c is the Nsurl, when uploaded to the C code when using [[url absolutestring] utf8string], in fopen when the FD is-1, no open file.


Tracking code, found that Nsurl point to the file path is file:///xxxx such a format, but if the nsstring point to the file path is/file/xxxx, in the Unix file system is certain that the former is unable to locate a file, The last way to modify the creation of the file and get the file by NSString to point to the file, must not use Nsurl

Files are not affected under document and TMP.


The above is to solve the problem of the harvest, blood lessons ah, took 30 minutes to find. I hope to be helpful to the friends I see.

Using the fopen function in an iOS system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.