Using C, how can I access the same block of memory as another C program?

So, I'm on hour one of learning C. Maybe I'll jump over to C++ tonight.

I'd like to create two command line programs using C that can "talk" to each other. The first thought that came to mind is to transfer information between the two by writing to and polling files. However, I figure C provides all the methods I need to directly allocate memory and access it, and that would be much faster and more sensible technique.

Can someone provide an example or advice?

Answers


What you are asking for is called shared memory. Unfortunately, shared memory is not part of the C language per se, but a feature of the operating system. Since you didn't specify what operating system you are using, I point you to a Unix SysV shared memory tutorial.


Need Your Help

Java JDBC Log in Form

java database swing jdbc login

I can't seem to get the password and user name on my Java JTextfield and Passwordfield, what I was trying to do is compare user input and check them if the username and password is stored in the

Count and group non-empty values in MySQL

mysql count group

I need to count the non-empty (by which I mean a string containing at least 1 character) rows grouped by a particular ID. Eg. my data might look like this: