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 8242277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:06:45+00:00 2026-06-07T21:06:45+00:00

This is for a homework assignment so I won’t be sharing my code. I’m

  • 0

This is for a homework assignment so I won’t be sharing my code. I’m only allowed to have “pencil down” discussions. I think that’s what he called it, so basically just a discussion. I’m not looking for code experts.

In my program, I fork multiple times and execlp openssl with dgst which returns a MD5 hash(?). I’m using this string to compare multiple files to see if they are identical.

Currently, the only way I have found to get the output from this is to use -out and save it to a file, but doing this over and over doesn’t append the file, it just rewrites the file so doing this is kind of a slow, painful process.

I’m asking if there is a way through exec or openssl that I can write this output string to a pointer that the parent could then access and manipulate from there so I am not writing to a file and reading it via the parent, one process at a time.

  • 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-06-07T21:06:47+00:00Added an answer on June 7, 2026 at 9:06 pm

    Before you fork, you can use pipe to create a pair of unidirectional file descriptors (one for reading, and one for writing). After you fork, you can use dup2 to set the writing end of the pipe for that child process to the output file descriptor and then exec. Then, when the parent reads from the reading end of the pipe, it will be reading what the child process is writing to its stdout.

    Since you are comparing output from multiple children processes, each child should have it’s own pipe.

    int fd[2];
    pipe(fd);
    pid_t pid = fork();
    if (pid == 0) {
        close(fd[0]);
        dup2(fd[1], 1);
        execlp(/*...*/);
    } else if (pid > 0) {
        close(fd[1]);
        while (read(fd[0], /*...*/) > 0) {
            /* ... */
        }
        wait4(&pid, /*...*/);
    }
    /* ... */
    

    This is just a mock-up of the calls you need to use. Your code will have to deal with reading from multiple pipes.

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

Sidebar

Related Questions

(this is indirectly a part of a much larger homework assignment) I have something
I have a homework assignment to sort an array in ascending order. Obviously, this
This is for a homework assignment, so I don't want the exact code, but
I have this homework assignment where the user is asked to input numbers and
So I'll admit that this is a homework assignment, but I'm not asking you
Note: This is a homework assignment. I have two classes, one inherits from the
I have a homework assignment that I am supposed to write a http server
For a homework assignment I wrote some scala code in which I have the
This is a homework assignment, just for all that want to know. I'm writing
So first off, this is a homework assignment, so please don't write any code

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.