Article View: comp.lang.pascal.delphi.misc
Article #100Re: redirecting standard I/O of console app from Parameters
From: Martin Harvey (Demon Account)
Date: Tue, 06 Apr 2004 22:09
Date: Tue, 06 Apr 2004 22:09
39 lines
2359 bytes
2359 bytes
On 30 Mar 2004 09:38:10 -0800, forums@mail.bg (Hmmm) wrote: >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 > >any ideas? Horrible hacky way: Yes, when you want to run the program, set it up instead to run: cmd /c myapp.exe < data.in > result.out or if you're using the older family of 32 OS's then do dosprmpt /c myapp.exe < data.in > result.out and that should do the trick - you need to use the part of the "run" dialog that allows you to execute an arbitrary executable. You'l have trouble debuggin your own app. Nice pleasant way: get your program to take command line parameters, and get it to do the file I/O itself. MH.
Technical Details
Message-ID:
<3ga670pp0ee4b1m3ae3t7a67ssf2d52atn@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newspeer1-win.server.ntli.net!newsfe3-win.server.ntli.net.POSTED!53ab2750!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: 10545b,38ff176ccba1a62d X-Google-Attributes: gid10545b,public X-Google-Thread: 10baee,38ff176ccba1a62d X-Google-Attributes: gid10baee,public X-Google-ArrivalTime: 2004-04-06 15:11:54 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newspeer1-win.server.ntli.net!newsfe3-win.server.ntli.net.POSTED!53ab2750!not-for-mail From: "Martin Harvey (Demon Account)" <martin@_nospam_pergolesi.demon.co.uk> Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.ide Subject: Re: redirecting standard I/O of console app from Parameters Message-ID: <3ga670pp0ee4b1m3ae3t7a67ssf2d52atn@4ax.com> References: <aaa4810e.0403300938.68846eca@posting.google.com> X-Newsreader: Forte Free Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 40 Date: Tue, 06 Apr 2004 23:09:06 +0100 NNTP-Posting-Host: 81.96.24.194 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfe3-win.server.ntli.net 1081289484 81.96.24.194 (Tue, 06 Apr 2004 22:11:24 GMT) NNTP-Posting-Date: Tue, 06 Apr 2004 22:11:24 GMT Organization: ntl Cablemodem News Service