Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Interaction between two programs

Reply
Thread Tools

Interaction between two programs

 
 
Denis Remezov
Guest
Posts: n/a
 
      05-20-2004
Sean wrote:
>
> I'm sure this might be a simple questions, but here it goes anyway. I
> am trying to do a 'front end' to a program. For example I have a
> program that doesn't take command line arguments, but prompts the user
> for input every time it is run, ie. Enter your name:
>
> I want to run a program that will automatically type the name into
> that field. I just don't really know where to start. Is this
> suppossed to be a spawn or an exec? I saw something about pipes, but
> didn't quite get it. Please explain for me.
>
> This is NOT for a class, just trying to learn how to do things



You could possibly make the use of the following:

Both C++ and C define three "standard streams": stdin, stdout and stderr.
The type of these expressions is FILE*, and they are required (I think;
need to double-check) to be open at the program start-up. See <stdio.h>
or <cstdio>.
The C++ objects cin, cout and cerr use the respective standard streams as well.

Now, what is hiding behind each of the standard stream depends on the way
the program was started (they could be attached to the terminal, to files,
to streams of another program, etc.). This part, however, is indeed system
dependent. One thing that is standard is the system() function, but its
behaviour is again system dependent.

Denis
 
Reply With Quote
 
 
 
 
Sean
Guest
Posts: n/a
 
      05-20-2004
I'm sure this might be a simple questions, but here it goes anyway. I
am trying to do a 'front end' to a program. For example I have a
program that doesn't take command line arguments, but prompts the user
for input every time it is run, ie. Enter your name:

I want to run a program that will automatically type the name into
that field. I just don't really know where to start. Is this
suppossed to be a spawn or an exec? I saw something about pipes, but
didn't quite get it. Please explain for me.

This is NOT for a class, just trying to learn how to do things
 
Reply With Quote
 
 
 
 
bartek
Guest
Posts: n/a
 
      05-20-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Sean) wrote in news:74cb4ff3.0405201251.27d1c150
@posting.google.com:

> I'm sure this might be a simple questions, but here it goes anyway. I
> am trying to do a 'front end' to a program. For example I have a
> program that doesn't take command line arguments, but prompts the user
> for input every time it is run, ie. Enter your name:
>
> I want to run a program that will automatically type the name into
> that field. I just don't really know where to start. Is this
> suppossed to be a spawn or an exec? I saw something about pipes, but
> didn't quite get it. Please explain for me.
>
> This is NOT for a class, just trying to learn how to do things


Your question has nothing to do with C++. It is off topic in this
newsgroup.

It is also very platform specific, though you don't even specify what
platform implementation you're interested in.

For unix, see news:comp.unix.programmer
Ask about pipe/popen, fork and exec.

For windows, see news:comp.os.ms-windows.programmer.*
Ask about CreatePipe, CreateProcess etc...

Cheers.
 
Reply With Quote
 
JKop
Guest
Posts: n/a
 
      05-20-2004
Sean posted:

> I'm sure this might be a simple questions, but here it goes anyway. I
> am trying to do a 'front end' to a program. For example I have a
> program that doesn't take command line arguments, but prompts the user
> for input every time it is run, ie. Enter your name:
>
> I want to run a program that will automatically type the name into
> that field. I just don't really know where to start. Is this
> suppossed to be a spawn or an exec? I saw something about pipes, but
> didn't quite get it. Please explain for me.
>
> This is NOT for a class, just trying to learn how to do things
>



This is a C++ newsgroup, no more no less. We conversate about C++ here. We
don't mention a word about platforms. You may find this a bit hard to
imagine, but think about things like: Encrypting Data, Encoding an MP3. Both
these processes are platform independant.


C++ is used to write programs for anything. A C++ compiler generates machine
code, which can be a Windows program, or the interface for your brand new
microwave, or the menus on your mobile phone.
Therefore, we don't talk about two programs running at once here in this
newsgroup. You're going to have to go to a very platform specific newsgroup
to talk about this. I myself am familiar with Win32 programming, so... if
the programs you're writing are Win32, then here's one way of going about
it:

First make your first program, into which you enter your name. You're done
with the first program now.

The trick is in writing the second program. I suggest that you use the
function "FindWindow" or a similar Win32API function that can be used to
obtain some sort of handle to the other program. Once you've got some sort
of handle, you use more Win32API functions to send information and/or
manipulate the first program. You'll most likely use the Win32 function
"SendMessage" for this.

Further questions on this subject to:

News Server: msnews.microsoft.com
Newsgroup: microsoft.public.win32.programmer.kernel

Note that the above newsgroup isn't language specific, so don't post any
code. People will simply tell you which Win32 function to use and in what
way. Make sure you tell them it's a console application.


Hope that helps.


-JKop
 
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
Interaction between User Controls goalizx Goalizx ASP .Net 1 09-03-2004 05:07 PM
Interaction with two mouse Michele Diegoli Python 4 02-07-2004 04:37 AM
Interaction between 2 different web browsers john ASP .Net 2 12-11-2003 07:43 PM
Interaction between 2 webforms Anita C ASP .Net 1 12-05-2003 12:53 PM
Interaction between two strings Ewout Perl Misc 6 11-11-2003 04:54 AM



Advertisments