Re: [CS3304_1381] input from file

New Message Reply About this list Date view Thread view Subject view Author view

Stephen Edwards (edwards@CS.VT.EDU)
Sat, 4 Mar 2000 22:28:30 -0500


Message-ID:  <200003050328.WAA19805@vtopus.cs.vt.edu>
Date:         Sat, 4 Mar 2000 22:28:30 -0500
From: Stephen Edwards <edwards@CS.VT.EDU>
Subject:      Re: [CS3304_1381] input from file

> I am having a hard time getting the functions provided on the web
> page to read from a file instead of from the console, any advise?

If your main program takes no arguments, you can call it like
this:

    (with-input-from-file "myinput.txt" my-program)

The "with-input-from-file" function temporarily redirects stdin so
that it comes from the named file instead of the console, then invokes
the function you give it, and then restores stdin back to the console.
That is probably the easiest way.

                                -- Steve

--
Stephen Edwards            641 McBryde Hall          Dept. of Computer Science
e-mail      : edwards@cs.vt.edu           U.S. mail: Virginia Tech (VPI&SU)
office phone: (540)-231-5723                         Blacksburg, VA  24061-0106
-------------------------------------------------------------------------------


New Message Reply About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Sat Mar 04 2000 - 22:28:35 EST