🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Execute DOS application

#12507
From: Timothy H. Buchman
Date: Tue, 09 Dec 2003 19:32
38 lines
2241 bytes
George <george@nospam.org> wrote in message
news:3fd5ac1f$1@newsgroups.borland.com...
> dosprog.exe --parameter --test --test2 < file.txt

Your problem is that you are using the DOS file piping operator, which
is not "executed" by dosprog.exe, it's executed by the DOS command
interpreter.  Here's one solution, based on code previously posted by
Chris Seymour.  You can search for more details at the site listed in
my signature. Obviously, you use your own command line, not the "type"
one below.

// <stdlib.h> required

void __fastcall TForm1::Button1Click(TObject *Sender)
{
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;

setmem(&StartupInfo,sizeof(StartupInfo),0);
StartupInfo.cb=sizeof(StartupInfo);

setmem(&ProcessInfo,sizeof(StartupInfo),0);

AnsiString strTPing = getenv("COMSPEC");

strTPing = strTPing + " /C type c:\\autoexec.bat "+" >test.txt";

CreateProcess(NULL, strTPing.c_str(), NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo,
&ProcessInfo);
}

--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Search .borland message archive on http://www.tamaracka.com/search.htm
Technical Details
Message-ID: <3fd62346@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fd5ac1f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,714ec80889168aad
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-09 11:40:20 PST
From: "Timothy H. Buchman" <tbuchmanPLEASE(at sign)REMOVEcitycenter.org>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fd5ac1f$1@newsgroups.borland.com>
Subject: Re: Execute DOS application
Date: Tue, 9 Dec 2003 14:32:03 -0500
Lines: 39
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 64.69.124.66
Message-ID: <3fd62346@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070998342 64.69.124.66 (9 Dec 2003 11:32:22 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail