简体   繁体   English

如何在devcpp中以非阻塞模式打开文件?

[英]How to open a file in non-blocking mode in devcpp?

I'm trying to write a server program in c, with DevCpp, that will create and edit about hundred of files every minute, of about 200 byte each. 我正在尝试使用DevCpp用c编写服务器程序,该程序每分钟将创建和编辑大约100个文件,每个文件大约200个字节。

The problem is that unistd.h , on devcpp, can't open files in nonblocking mode (it seems): I wanted to use open() with the O_NONBLOCK flag, but seems to not exist in the libraries (I have already checked in fcntl.h ). 问题是在devcpp上的unistd.h无法以非阻塞模式打开文件(看来):我想将open()O_NONBLOCK标志一起使用,但似乎在库中不存在(我已经检查过了) fcntl.h )。

What do you recommend me to do? 你推荐我做什么? Should I search for another version of unistd.h, rather than the one provided by DevCpp, or should I use another library? 我应该搜索unistd.h的另一个版本,而不是DevCpp提供的版本,还是应该使用另一个库?

I wish to keep the code as simply as possible, in order to create a fast and reliable server program, in C language. 我希望代码尽可能简单,以便使用C语言创建快速可靠的服务器程序。 Thanks in advance. 提前致谢。

open()及其标志的头是<fcntl.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM