Ask the experts about the named pipeline (fifo): one error is that debugging fails.
Source: Internet
Author: User
Ask the experts about the named pipeline (fifo): An error is that debugging fails-Linux general technology-Linux technology and application information. For details, refer to the following. Today, I debugged a program related to the pipeline, but I haven't been playing it out for half a day. Ask the experts:
The pipeline is successfully established, that is, an error occurred while opening the pipeline ~
Error message: No such device or address
What is the problem? Thank you!
# Define WFIFO "writefifo"
Char buf [256];
Int w_fd;
Struct stat stat_buf;
Printf ("begin to create writefifo \ n ";
Int ret = mkfifo (wfirst, 0666 );
Printf ("ret = % d \ n", ret );
If (ret =-1 ){
Printf ("Fail to create fifo % s: % s \ n", WFIFO, strerror (errno ));
Exit (-1 );
}
Strcpy (buf, s );
Printf ("buf: % s \ n", buf );
Printf ("get w_fd \ n ";
W_fd = open (WFIFO, O_WRONLY | O_NONBLOCK );
Printf ("writefifo's fd: % d \ n", w_fd );
If (w_fd =-1 ){
Printf ("Fail to open fifo % s: % s \ n", WFIFO, strerror (errno ));
Exit (-1 );
}
This is the intermediate pipeline code, which is an error in w_fd = open (WFIFO, O_WRONLY | O_NONBLOCK,
Error message: Fail to open writefifo: No such device or address;
If this sentence is changed to w_fd = open (WFIFO, O_RDONLY | O_NONBLOCK); it will be okay, but I want to open it in writing ~
Which expert can give me some advice ~~
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.