![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shared memory read/write using threads | kumars | High Level Programming | 2 | 06-18-2008 03:01 PM |
| HP-UX Trying to Understand Shared Memory Segments | scotbuff | HP-UX | 2 | 03-17-2008 05:05 PM |
| Shared memory in shared library | DreamWarrior | High Level Programming | 12 | 05-30-2007 04:33 PM |
| Shared Memory segments | catwomen | HP-UX | 2 | 02-28-2006 10:07 AM |
| Shared memory shortage but lots of unused memory | cjcamaro | UNIX for Advanced & Expert Users | 1 | 10-13-2004 05:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Write into shared memory segments
I have created a shared memory segment (which size is 64 bytes) using shmget, shmat e.t.c and i want to divide it into 2 areas. One area for input data and one area for output? How can i do that?
Furthermore, When i have to write my input data into the shared memory segment i want to write something like this: a text messase, an integer, another integer Which function of c should i use? If i had to write only a text message and read it from another process i would use memcpy, but now i have the text messase and two integers (which i use as flags in my code). |
|
||||
|
You can memcpy them - integers are stored in binary format, not as textual digits.
To read it back out, you have to know the exact format of what was written to start with. IF you don't like that use sprintf() then memcpy(); |
|
||||
|
Quote:
If that's not what you mean then I don't understand your question. Why not just use the upper and lower halves as is? |
|
||||
|
mmap PROT_READ and PROT_WRITE I think would probably work for what you want to do
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|