Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > accessing memory directly from C++

Reply
Thread Tools

accessing memory directly from C++

 
 
rajangamsj@gmail.com
Guest
Posts: n/a
 
      02-20-2007
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

 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      02-20-2007
* http://www.velocityreviews.com/forums/(E-Mail Removed):
> 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?
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      02-20-2007
On 19 Feb 2007 19:45:06 -0800, (E-Mail Removed) 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
 
Reply With Quote
 
Grizlyk
Guest
Posts: n/a
 
      02-25-2007

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/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent user from accessing any page directly without Login ? Luqman ASP .Net 4 09-17-2007 03:47 PM
directly accessing the aspnet_* tables Larry Bud ASP .Net 1 05-21-2007 08:45 PM
GridView Directly Accessing the Edit of FormView mosscliffe ASP .Net 1 05-22-2006 05:15 PM
DOS Directly accessing hard disk... Travis Computer Information 2 11-03-2005 06:01 AM
Preview image directly on PC, save directly to HD Patrick M. Digital Photography 3 01-07-2004 08:29 PM



Advertisments