Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,150 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,105 people online right now. Registration is fast and FREE... Join Now!




Passing command line variable into already running c++ program

 
Reply to this topicStart new topic

Passing command line variable into already running c++ program

jobra
25 Feb, 2007 - 07:38 PM
Post #1

New D.I.C Head
*

Joined: 10 Dec, 2006
Posts: 3


My Contributions
Hi all,

I want to run my c++ program in the background and at certain point, I want to pass a variable into the program, so that I get the result stored into the output file. I would like to know if its possible to do this. Thanks a lot in advance.

Cheers
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Passing Command Line Variable Into Already Running C++ Program
25 Feb, 2007 - 09:51 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,858



Thanked: 49 times
Dream Kudos: 550
My Contributions
Of course it is possible. To know HOW to do it you need to let us know the environment you are working in. In windows you might pass the process a message, in Dos you can pass the information via and interupt. I don't know how to do it in UNIX but I am sure someone here dose.

What environment are you working in.
User is offlineProfile CardPM
+Quote Post

jobra
RE: Passing Command Line Variable Into Already Running C++ Program
25 Feb, 2007 - 10:00 PM
Post #3

New D.I.C Head
*

Joined: 10 Dec, 2006
Posts: 3


My Contributions
QUOTE(NickDMax @ 25 Feb, 2007 - 10:51 PM) *

Of course it is possible. To know HOW to do it you need to let us know the environment you are working in. In windows you might pass the process a message, in Dos you can pass the information via and interupt. I don't know how to do it in UNIX but I am sure someone here dose.

What environment are you working in.


Thanks a lot for your reply. I am using cygwin (linux) environment.


User is offlineProfile CardPM
+Quote Post

horace
RE: Passing Command Line Variable Into Already Running C++ Program
25 Feb, 2007 - 11:19 PM
Post #4

D.I.C Addict
Group Icon

Joined: 25 Oct, 2006
Posts: 573



Thanked: 4 times
Dream Kudos: 50
My Contributions
read up on IPC (Interprocess communication) such as pipes, signals, messages, etc
http://www.cs.cf.ac.uk/Dave/C
http://fscked.org/writings/SHM/shm.html

You can run a process which can pass the data to the background program using IPC, for example a named pipe.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 11:02PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month