Hi there,
Im new to this site, and I just have a question of something that I have been trying lately in the C language.

I need to put a whole array in a shared memory file (using POSIX).
I have no problems putting simple int* in shared memory. I do it this way:

int main(int argc, char* argv[]){
int *ptr;
int fd=shm_open("/shm12",O_RDWR|O_CREAT,S_IRUSR|S_IWUSR);

Thats basically it, without error checking. What do I need to do to simillarly put an array, lets call it buffer[10], in shared memory?
Id apprecciate if anyone could help me.

Recommended Answers

Here are some examples

Jump to Post

All 2 Replies

Here are some examples

Thank you that helped understand it a little better.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.