Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/stat.h>
- int main()
- {
- int fildes[2];
- if (pipe(fildes) == -1) {
- const int e = errno;
- fprintf(stderr, "`pipe` failed: %s (%d)\n", strerror(e), e);
- return EXIT_FAILURE;
- }
- struct stat buf;
- if (fstat(fildes[0], &buf) == -1) {
- const int e = errno;
- fprintf(stderr, "`fstat` failed: %s (%d)\n", strerror(e), e);
- return EXIT_FAILURE;
- }
- printf("buf.st_mode=0x%08x\n", (int)buf.st_mode);
- if (!S_ISFIFO(buf.st_mode)) {
- printf("!");
- }
- printf("S_ISFIFO(buf.st_mode)\n");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement