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

  • Home
  • SEARCH
  • 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 6970463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:42:48+00:00 2026-05-27T16:42:48+00:00

I have a server and client application, using IPC queues. The server is (for

  • 0

I have a server and client application, using IPC queues. The server is (for now) simply sending back the text received from the client. I would like the server to change the letters in the message from lower to upper case. I’m wondering how to achieve it. Do I have to create a pipe? I’m thinking about ‘grabbing’ the text from the received queue, executing the tr command on it and sending back to the client. But if using a pipe, from where do I get the file descriptors? I mean, int fds[2]; and pipe(fds); gives me a pipe, but it’s not working on two char arrays like this:

int fds[2];
pipe(fds);
char a[100];
char b[100];
fds[0] = open(a,O_RDOLNY);
fds[1] = open(b,O_WRONLY);

How can I execute a tr command on a text held by a message queue?

  • 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-27T16:42:49+00:00Added an answer on May 27, 2026 at 4:42 pm

    I wouldn’t fork a program for this:

    p = str;
    while (*p) {
        *p = toupper(*p);
        p++;
    }
    

    More seriously, you should probably use popen that automatically (and robustly) forks and uses a pipe to setup a FILE * for you.

    FILE *cmd = popen("tr ... ", "r");
    

    And then simple fgets from it (don’t forget to pclose it). Sadly on Linux you can’t write and read to a popened file at the same time (you can on FreeBSD).

    EDIT

    Since this is a homework question (and frankly because I don’t think it’s trivial to get it completely right at this time of night), here is what popen actually does:

    • Create a pipe
    • Fork a shell that will run the command
    • Return a FILE * (possibly via fdopen)

    The last step is really optional as you could always read from the file descriptor directly.

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

Sidebar

Related Questions

I have a client-server application written in Java using CORBA for the communication. The
I have a .NET client application that needs to communicate with a server using
I have a client server application that sends XML over TCP/IP from client to
I have a client Server application which communicate using objects. when I send only
I have a client server application writter in C# .NET using Sockets. I often
I'm using Indy10 under Delphi2009. I have a server/client application, with TidTCPServer and TidTCPClient.
I have client server cocoa application. client communicate with server by using server's IP
I have written a server/client application using sockets in C# for .NET 3.5. I'm
I have a client/server application built using DataAbstract and RemObjects where the client is
I have a client-server application, which communicates using WCF, and uses NetDataContractSerializer to serialize

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.