Link to home
Start Free TrialLog in
Avatar of TheMoog
TheMoogFlag for United Kingdom of Great Britain and Northern Ireland

asked on

access memory from another process c plus plus

Hi chaps, can anyone explain to me how the following could be achieved?  

I create a console ap which reads data into memory, there is an overall pointer that accesses the collection.  The collection is arrays that are on the heap and the collection is just pointers to the arrays thats basically it.

What I want to know and if it can be done how to do it is this:

I want to read the data into memory at the start of the day and just leave it open until I close the application.  I want to run a new console application ie another separate process and access the data thats already in memory.  Can this be done? and How?  Cheers

PS Im in native C++ not managed.
ASKER CERTIFIED SOLUTION
Avatar of subn0wa
subn0wa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TheMoog

ASKER

subn0wa thank you so much this has saved me so much arsing about.  It works perfectly :)
Avatar of avivshabo
avivshabo

Can you help me, I cant compile:
--------------------Configuration: memory - Win32 Debug--------------------
Compiling...
memory.cpp
C:\Documents and Settings\XPL.XPL-7B13B0B6955\memory.cpp(9) : error C2664: '_wtoi' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\XPL.XPL-7B13B0B6955\memory.cpp(13) : error C2664: '_wtoi' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\XPL.XPL-7B13B0B6955\memory.cpp(16) : error C2065: 'wprintf' : undeclared identifier
C:\Documents and Settings\XPL.XPL-7B13B0B6955\memory.cpp(23) : error C2664: '_wtoi' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\XPL.XPL-7B13B0B6955\memory.cpp(32) : error C2664: 'wsprintfA' : cannot convert parameter 1 from 'unsigned short [32767]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
try to change "w" function to their ansi analogs, _wtoi => atoi, wprintf => printf, etc.
Avatar of Subrat (C++ windows/Linux)
Try it...
project->property->configuration property->charecter set-> use  unicode charecter set.