how to write a structure in a shared mem segment.
- From: "nass" <athanasios.silis@xxxxxxxxx>
- Date: 25 Sep 2006 02:56:46 -0700
hi all,
i am running slackware linux and need to use some function that will
will enable me to write and read a STRUCT from a shared mem segment..
i am using open() , to open a file (and get the file descriptor fd
returned), and then use mmap to get a void* file_memory pointer.
function fwrite() (from stdio.h) doesn't work cause it can write to a
file (ie needs a FILE* nor a void* and casting in this case makes the
executable crash), nor does write() (from unistd.h), ie the linux
standard write function, that needs as input the file decriptor (int)
fd instead of the (void*) file_memory pointer...
and i don't think i can use sprintf because it needs you to define the
type of variable you are giving as an argument to it (%d for decimal,
%f for float, %p for pointer, %s for string etc..) and i do not know
how to 'define' the structure that i want to save... or am i wrong in
thinking that and there is a type i can use to store my structure?
i have already posted a similar msg in c++ groups, but they suggested
that this is a more appropriate group to write to.
thankyou for your help
nass
.
- Follow-Ups:
- Re: how to write a structure in a shared mem segment.
- From: kondal
- Re: how to write a structure in a shared mem segment.
- From: "Nils O. Selåsdal"
- Re: how to write a structure in a shared mem segment.
- Prev by Date: Re: open FIFO erro
- Next by Date: Re: how to write a structure in a shared mem segment.
- Previous by thread: Binary Source Code
- Next by thread: Re: how to write a structure in a shared mem segment.
- Index(es):