Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7084391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:44+00:00 2026-05-28T07:17:44+00:00

I created and written to a named pipe in C under Linux. For how

  • 0

I created and written to a named pipe in C under Linux. For how long the text that is written in there is saved in the named pipe?

From what I have done, and the bytes of the pipe file after my program is run I suppose that the text is not preserved in the pipe after the program ends. In the mkfifo manual there is no info about this. I know that ordinary pipes are destroyed after the process that have created them is closed. But what about named pipes, that are still in your file system after the program has finished?

This is the code I use to create a named pipe and to write/read from it.

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[]) {
    int FIFOFileDescriptorID;
    FIFOFileDescriptorID = mkfifo(argv[1], 0660);

    int ProccesID = fork();
    if (ProccesID == 0) {
        int TempFileDescriptor = 0;
        char buffer[512] = "Some random text goes here...";

        TempFileDescriptor = open(argv[1], O_WRONLY);
        write(TempFileDescriptor, &buffer, sizeof(buffer));
        close(TempFileDescriptor);
    } else {
        int TempFileDescriptor = 0;
        char buffer[512];

        TempFileDescriptor = open(argv[1], O_RDONLY);
        read(TempFileDescriptor, &buffer, sizeof(buffer));
        close(TempFileDescriptor);
        printf("Received string: %s\n", buffer);
    }

    return 0;
}

After I have run this program and created and use the pipe for write/read, I run another one – just to read the text from the given pipe. Indeed, there was no text there.

I will exam this thing better, because there is a good change, after I start the program do delete/create the pipe again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:17:45+00:00Added an answer on May 28, 2026 at 7:17 am

    It’ll not save anything. When you read/write something to the named pipe, it the process will be blocked unless some other process writes/reads from the same named pipe.

    The file stays in the file-system. But the content goes away when reading/writing finishes.

    From linux manual,

    Once you have created a FIFO special file in this way, any process
    can open it for reading or writing, in the same way as an ordinary file.
    However, it has to be open at both ends simultaneously before you can
    proceed to do any input or output operations on it
    . Opening a FIFO for
    reading normally blocks until some other process opens the same FIFO for
    writing, and vice versa.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab bar controller that I have created programmatically, named TPastJourneyTabbar .
I have written a class to handle named pipe connections, and if I create
I have created a sample application named (WindowStartup.EXE) that display the Computer name, OS
In VS2008 I have written a C# service, an installer, and have created a
I have written code that automatically creates CSS sprites based on the IMG tags
I have written a CGI script that creates an image dynamically using GET data.
I have written an apex class that will create a PDF quote and attach
I have a class library that I have written in C#.net. I want to
I am trying to write a named pipe server in C++. I have a
Is there a way to create non blocking/asynchronous named pipe or something similar in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.