Article View: comp.lang.pascal.delphi.misc
Article #97Re: redirecting standard I/O of console app from Parameters
From: Bruce Roberts
Date: Tue, 30 Mar 2004 19:01
Date: Tue, 30 Mar 2004 19:01
22 lines
2222 bytes
2222 bytes
"Hmmm" <forums@mail.bg> wrote in message news:aaa4810e.0403300938.68846eca@posting.google.com... > i wrote a console app with delphi 7 > in prompt i coul write this > > myapp.exe < data.in > result.out > > so where there is readln in the code, this will be read from "data.in" > file, and where there is writeln, it will be write to "result.out" > file. > > is there way to do this redirection without using prompt (When in > delphi IDE i press F9, standard input to come from data.in and so on). > In Run->Parameters... in Parameters text box i type this: < data.in > > result.out, but it doesnt work It really depends on how the program is being run, since the runner is the one that does the mapping. If you are running it from another program you can use CreateProcess. A goggle search will turn up several examples of i/o redirection using CreateProcess. As a general solution, you could have the app parse the command line and do its own redirection.
Technical Details
Message-ID:
<GBjac.57$%41.3391@news20.bellglobal.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!in.100proofnews.com!tdsnet-transit!newspeer.tds.net!cyclone.bc.net!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mailReferences:
<aaa4810e.0403300938.68846eca@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10baee,38ff176ccba1a62d X-Google-Attributes: gid10baee,public X-Google-Thread: 10545b,38ff176ccba1a62d X-Google-Attributes: gid10545b,public X-Google-ArrivalTime: 2004-03-30 11:24:38 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!in.100proofnews.com!tdsnet-transit!newspeer.tds.net!cyclone.bc.net!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail From: "Bruce Roberts" <ber@bounceitattcanada.xnet> Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.ide References: <aaa4810e.0403300938.68846eca@posting.google.com> Subject: Re: redirecting standard I/O of console app from Parameters Lines: 24 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <GBjac.57$%41.3391@news20.bellglobal.com> Date: Tue, 30 Mar 2004 14:01:29 -0500 NNTP-Posting-Host: 67.70.9.151 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1080673766 67.70.9.151 (Tue, 30 Mar 2004 14:09:26 EST) NNTP-Posting-Date: Tue, 30 Mar 2004 14:09:26 EST Organization: Bell Sympatico