🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#11420
From: Jerri Chiu
Date: Mon, 09 Feb 2004 18:01
24 lines
1619 bytes
Hi,

I would like to know if this is do-able from Windows:
have a Windows application, calls a shell command (either using
WinExec, ShellExecute or CreateProcess), that executes an
RSH command, capture the standard output of this command
put it into a file, in the LOCAL machine (the RSH executes
a program on the UNIX server).

I have tried using WinExec() to do this, the code looks like
this:
String strCmd = "rsh hosta -l usera -n ls > temp.txt";
WinExec(strCmd, SW_HIDE);

this file temp.txt ends up on the UNIX server!

Also, I couldn't get ShellExecute to do the same thing.  the
local machine is a W2K machine.  Is ShellExecute() recommended
over WinExec()?  I can use CreateProcess() to do it as well.

Thanks for any suggestions!

Jerri
Technical Details
Message-ID: <4027cb10$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,310df85c3f4e1fd7,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-09 10:10:24 PST
From: "Jerri Chiu" <jerrichiu@yahoo.com>
Sender: "Jerri Chiu" <jerrichiu@yahoo.com>
Reply-To: "Jerri Chiu" <jerrichiu@yahoo.com>
Subject: 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     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4027cb10$1@newsgroups.borland.com>
Date: 9 Feb 2004 10:01:52 -0800
X-Trace: newsgroups.borland.com 1076349712 207.105.83.66 (9 Feb 2004 10:01:52 -0800)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail