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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:29:51+00:00 2026-06-15T22:29:51+00:00

TLDR : I’m using a variable of type void * to hold a string

  • 0

TLDR: I’m using a variable of type void * to hold a string pointer, how do I modify the value of the string?

BACKGROUND
Homework assignment with IPC has arisen.
I have two processes, chefs and waiters where the waiters give some input to the chefs (party seated, table orders, ready to check out etc.), and then the chef sends the information back to the relevant waiter (obviously not all waiters are serving all the tables at the same time).

My (admittedly clunky) solution:
1. Chef opens ‘chef’ FIFO file to read

2. Waiter opens ‘chef’ to write and writes the name of the waiter, and opens a FIFO with that name to read.

3. Chef reads name of the waiter and opens the FIFO to write.

3.a. (Not really relevant to the issue I’m having) Waiter sends input through ‘chef’, until the chef closes down the system.

4. During the waiters input, occasionally the chef will have to send information back. When the chef enters output, a check occurs to determine which output FIFO to write to.

QUESTION
I have two pthreads, and need to send a string back. I have passed a string pointer as the one parameter I’m given, (in this case called void *arg), then when I need to send some information back, I’m trying to just put the string in in the pointer I passed but have yet to find anyway to do that. So my question is, how might I do it this way?

  • 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-15T22:29:52+00:00Added an answer on June 15, 2026 at 10:29 pm

    I wound up utilizing the following:

    string* temp = static_cast<string*>(arg);
    

    Then modified just modified temp. Since arg held the location of the string back in the main thread, temp took it and then I could put the string in temp. Inter-thread communication was thus established, and I was able to continue implementing my terrible design.

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

Sidebar

Related Questions

TLDR: What are the pros/cons of using an in-memory database vs locks and concurrent
TLDR I need to change a javascript variable on the same page after clicking
Background (TLDR; provided for the sake of completion) Seeking advice on an optimal solution
Suppose I have this class: type Pet (name:string) as this = let mutable age
tldr: how to create List of abstract type BankAccount and add concrete sub types
TLDR; How do I read data from a table using Entity Framework, when the
TLDR; skip to the bottom paragraph for the main question. I'll try to keep
The TLDR version: Bulk Insert will tell you how many rows it affected. It
Since I got TLDR (too long didn't read) comments, I stripped 90% of this
TLDR: I'm looking for a way to serve web resources (css, jpg, etc) from

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.