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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:54:09+00:00 2026-05-26T17:54:09+00:00

I have a structure like struct board{ char name; int values[37]; }board Imagine a

  • 0

I have a structure like

struct board{
   char name;
   int values[37];
}board

Imagine a game where there are several players playing at a single table and they all make different bets on different positions of the values array.The name of the board is unique and a player enters a game specifying the board name. If 2 or more players enter the same board name they all join the same game.

I need to put this structure into shared memory and access/modify the contents of “values”
from different processes at the same time (semaphores are not a problem). I managed to copy the structure in a piece of shared memory but I don’t how to access the name to see if a board already exists and things like that.

This is for a school project and I’m a little desperate…. pleeease help and thanks. By the way, the shared memory I want references to the POSIX os

  • 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-26T17:54:10+00:00Added an answer on May 26, 2026 at 5:54 pm

    The POSIX shared memory functions are already written with this sort effort in mind:

    int shm_open(const char *name, int oflag, mode_t mode);
    

    If you use "/onica_game_<name>" for your *name parameter, you can easily specify which shared memory segments to attach to for your shared games. (Incidentally, a single char is a bit limiting for game names. You might want to use char name[32]; or something larger to give people an opportunity to name their games something more meaningful.)

    I suggest prefixing the name with onica_game_ because the namespace for POSIX shared memory segments is system-wide.

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

Sidebar

Related Questions

I have a structure like struct category { int id,newID; std::string name; }; and
Let's say I have a first structure like this: typedef struct { int ivalue;
I have a structure defined like so: typedef struct { int n; int *n_p;
I have a List of an Record(structure) like this : struct Rec { int
If I have structure definitions, for example, like these: struct Base { int foo;
I have a data structure like this: struct foo { int id; int route;
I have a structure like this. struct A { int someFun() const; int _value;
I have a header file including a structure like this: typedef struct { int
I have a structure, that contain string. Something like that: struct Chunk { int
I have a structure like this typedef struct{ int stat; }dot; And I would

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.