FILE *srcFile = fopen(binaryPath, "r");
if (srcFile == NULL)
{
int errNum = 0;
errNum = errno;
printf("open fail errno = %d reason = %s \n", errNum, strerror(errNum));
fprintf(stderr, "Error: Could not open binary %s\n", binaryPath);
exit(1);
}
显示结果是
open fail errno = 1 reason = Operation not permitted
Error: Could not open binary /Users/sorke/Library/Developer/Xcode/DerivedData/testOpen-bubwyliyuporlthhugwnbxxxdhph/Build/Products/Debug-iphoneos/testDynamic.dylib