你能在iPhone上使用C open(const char* name, int flag)函数吗?
我正在尝试移植一个库以在 iPhone 上运行,该库利用内存映射和许多其他东西。我注意到还缺少一堆 #defines (O_RDONLY),它们应该在
中定义。
I am trying to port a library to run on the iPhone which makes use of memory mapping and a bunch of other stuff. I noticed a bunch of #defines missing as well (O_RDONLY) which should be defined in <fcntl.h>
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用它,但默认情况下,
fcntl.h
标头不包含在 Foundation 或 UIKit 框架中。要使用open(2)
系统调用,只需在使用该标头的任何位置导入该标头(或将其添加到预编译的标头文件中)即可。例如:
You can use it, but the
fcntl.h
header is not included in the Foundation or UIKit frameworks by default. To use theopen(2)
system call, simply import that header wherever you use it (or add it to your pre-compiled header file).For example:
为什么不呢?它可能存在的唯一问题是苹果不接受它,因为他们扫描程序中的系统调用。但我相信开放系统调用就可以了。
Why not? The only problem that it might have is apple not accepting it, as they scan programs for system calls. But I believe an open system call is fine.
为我工作的代码:
worked code for me: