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

Is there a way to export a TeeChart to PDF?

c++ c++builder teechart

I've created a TeeChart in RAD Studio XE8 C++ Builder. I know you can use Print or PrintPartial to output to a printer. I'm wondering if there's a way to output this TeeChart to a PDF?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.