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