home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / READLOOP.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  529 b   |  22 lines

  1.  
  2. (*********************************************************************
  3.  
  4.         Adapted from
  5.         Roman E. Maeder: Programming in Mathematica,
  6.         Second Edition, Addison-Wesley, 1991.
  7.  
  8.  *********************************************************************)
  9.  
  10.  
  11. ReadLoop[fileName_String] :=
  12.     Module[{file, expr},
  13.         file = OpenRead[fileName];
  14.         If[ file === $Failed, Return[] ];
  15.         While[ True,
  16.             expr = Read[file];
  17.             If[ expr === EndOfFile, Break[] ];
  18.             Print["expr is ", expr]
  19.         ];
  20.         Close[file]
  21.     ]
  22.