🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11425

Re: How to get the standard output of an RSH command using WIN32 API

#11425
From: Jerri Chiu
Date: Mon, 09 Feb 2004 19:27
42 lines
2309 bytes
Hi there,

Thanks for replying my question.

That is what I am doing now, using the CreatePipe() and later on
ReadFile() to see my outputs, however, the interesting thing is,
when I am debugging it, in the case that it should fail, the
buffer that read was the IP address the local machine.  and in
the case that it should succeed, it's 'Terminal Read'.

However, if I do the same experiment on the command prompt,
the first case should returns something like:
...: Permission Denied.... etc.
and in the 2nd case, it should return some successful message
after the program finishes on the UNIX server.

I am looking for that successful message, should I force my
program to wait until the RSH is finished? and when it does,
does it still write to the pipe that I created?

Thanks so much!
Jerri


"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
>
>"Jerri Chiu" <jerrichiu@yahoo.com> wrote in message
>news:4027cb10$1@newsgroups.borland.com...
>
>> String strCmd = "rsh hosta -l usera -n ls > temp.txt";
>
>Use CreateProcess().  The STARTUPINFO structure allows you to specify your
>own STDIN/OUT/ERR handles for the spawned process.  Use CreatePipe() to
>create a handle that you then supply as the hStdOut member of STARTUPINFO,
>and then use ReadFile() to read any data that is sent to the pipe by the
>process.
>
>
>Gambit
>
>
Technical Details
Message-ID: <4027df0a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4027cb10$1@newsgroups.borland.com> <4027d1ec$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,310df85c3f4e1fd7
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-09 11:31:39 PST
From: "Jerri Chiu" <jerrichiu@yahoo.com>
Sender: "Jerri Chiu" <jerrichiu@yahoo.com>
Reply-To: "Jerri Chiu" <jerrichiu@yahoo.com>
Subject: Re: How to get the standard output of an RSH command using WIN32 API
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 65.207.116.227     
References: <4027cb10$1@newsgroups.borland.com> <4027d1ec$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4027df0a$1@newsgroups.borland.com>
Date: 9 Feb 2004 11:27:06 -0800
X-Trace: newsgroups.borland.com 1076354826 207.105.83.66 (9 Feb 2004 11:27:06 -0800)
Lines: 43
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail