473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

accessing memory directly from C++

Hello all,
I have a C++ program (prog1) which does some some actions and uses
array for it. The start address of the array is known once the program
is run.

Now I have another independent program(prog2) which needs to
access the same array used by prog1 and do some set of actions (like
display the contents etc). It is not possible/desiarable to have both
these programs as part of a single exe file. They need to be in 2
different exe files.

Is there any which this could be made possible?? We tried writing
the address to a file in prog1 and read it from prog2, but we are
unable to assign the content in the file to a pointer variable in
prog2.

Regards,
Rajangam

Feb 20 '07 #1
3 1900
* ra********@gmail.com:
I have a C++ program (prog1) which does some some actions and uses
array for it. The start address of the array is known once the program
is run.

Now I have another independent program(prog2) which needs to
access the same array used by prog1 and do some set of actions (like
display the contents etc). It is not possible/desiarable to have both
these programs as part of a single exe file. They need to be in 2
different exe files.

Is there any which this could be made possible?? We tried writing
the address to a file in prog1 and read it from prog2, but we are
unable to assign the content in the file to a pointer variable in
prog2.
The C++ language and its standard library does not provide any means of
interprocess communication.

How to do that depends on your OS and so is off-topic in [comp.lang.c++].

Since you mention "exe" you're probably using Windows, and if so then
you might try posting in [comp.os.ms-windows.programmer.win32], or see
this group's FAQ for some other possibly relevant groups.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Feb 20 '07 #2
On 19 Feb 2007 19:45:06 -0800, ra********@gmail.com wrote in
comp.lang.c++:
Hello all,
I have a C++ program (prog1) which does some some actions and uses
array for it. The start address of the array is known once the program
is run.

Now I have another independent program(prog2) which needs to
access the same array used by prog1 and do some set of actions (like
display the contents etc). It is not possible/desiarable to have both
these programs as part of a single exe file. They need to be in 2
different exe files.
Then there is absolutely nothing at all in the standard C++ language
that can help you. There is no concept of "another executable" in the
language defined by the standard.
Is there any which this could be made possible?? We tried writing
the address to a file in prog1 and read it from prog2, but we are
unable to assign the content in the file to a pointer variable in
prog2.
There is probably a way to do this with non-standard extensions
provided by your operating system and compiler, but you need to ask in
a group that supports your particular compiler/OS combination.

At a guess, try news:comp.os.ms-windows.programmer.win32

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Feb 20 '07 #3

Jack Klein wrote:
>
There is probably a way to do this with non-standard extensions
provided by your operating system and compiler, but you need to ask in
a group that supports your particular compiler/OS combination.

At a guess, try news:comp.os.ms-windows.programmer.win32
Also see POSIX IPC functions.

--
Maksim A. Polyanin
http://grizlyk1.narod.ru/cpp_new

"In thi world of fairy tales rolls are liked olso"
/Gnume/
Feb 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Suzanne Vogel | last post by:
Hi, Given: I have a class with protected or private data members, some of them without accessor methods. It's someone else's class, so I can't change it. (eg, I can't add accessor methods to the...
13
by: lupher cypher | last post by:
Hi, I'm trying to access memory directly at 0xb800 (text screen). I tried this: char far* screen = (char far*)0xb8000000; but apparently c++ compiler doesn't know "far" (says "syntax error...
2
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point...
14
by: sachin_mzn | last post by:
Hi, Why I am not getting any run time error while accessing a freed memory in following code. This is printing h in std output. #include<stdio.h> main() { char* buffer = (char*)malloc(6);...
1
by: Ronald de Feijter | last post by:
In a mechatronic system I can control some motors and servos by setting values between 0 and 255 at specific memory addresses. My problem is how to access these memory addresses within C#. I know...
2
by: Bae,Hyun-jik | last post by:
Hi, My managed C++ library frequently takes LPCTSTR from managed exe. Due to the fact that my library doesn't modify string buffer if its parameter type is LPCTSTR, it won't be required to copy...
5
by: Soren S. Jorgensen | last post by:
Hi, I've got a web-app thats activated by a call to a aspx page from ASP, I need to go back to the ASP session and get some simple data saved in that session. I have no possiblity to do...
5
by: TS | last post by:
is it preferred to access member variables directly in code, on the page that declared them, versus going thru a property accessor? I would think that since theres no security concerns or anything...
5
by: Max2006 | last post by:
Hi, What is the limit for memory that a .NET process or AppDomain can use? Thank you, Max
8
by: GaryDean | last post by:
I have a Wizard page and need to affect the next and previous buttons from my code-behind. I've googled around and found two solutions, and neither appear to work. I can access the SideBarList...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.