accessing memory directly from C++

Discussion in 'C++' started by rajangamsj@gmail.com, Feb 20, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. * :
    > 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?
     
    Alf P. Steinbach, Feb 20, 2007
    #2
    1. Advertising

  3. Jack Klein Guest

    On 19 Feb 2007 19:45:06 -0800, 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/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Feb 20, 2007
    #3
  4. Grizlyk Guest

    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/
     
    Grizlyk, Feb 25, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mosscliffe
    Replies:
    1
    Views:
    1,890
    mosscliffe
    May 22, 2006
  2. Larry Bud

    directly accessing the aspnet_* tables

    Larry Bud, May 21, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    382
    sloan
    May 21, 2007
  3. Luqman
    Replies:
    4
    Views:
    1,250
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Sep 17, 2007
  4. Adam Getchell

    Directly Accessing a Principal Object

    Adam Getchell, Mar 31, 2005, in forum: ASP .Net Security
    Replies:
    0
    Views:
    110
    Adam Getchell
    Mar 31, 2005
  5. Replies:
    6
    Views:
    165
    John Turner
    Sep 29, 2006
Loading...

Share This Page