home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / SREFPRC1 / GRABFIL1.SRF < prev    next >
Text File  |  1996-07-13  |  735b  |  28 lines

  1. /*----------------------------------------------------------------------- */
  2. /* GRAB_FILE read in a file, but first check to see if openable, and if
  3. .   openable, open and read it.
  4. .    Returns with the file, or with 0 if file not obtainable.
  5. .    Note that file is closed before returning.
  6. .    usage:   afile_string=grab_file(the_file,seconds_to_try_for)
  7. */
  8. /* ----------------------------------------------------------------------- */
  9.  
  10.  
  11. sref_grab_file:
  12.  
  13. parse arg afile , msec
  14. ause=sref_open_read(afile,msec)
  15. if ause<0 then
  16.   return 0
  17.  
  18. goo=charin(afile,1,chars(afile))
  19. ause=stream(afile,'c','close')
  20.  
  21. /* get rid of ending ctl-z */
  22. if c2d(right(goo,1))=26 then
  23.   goo=left(goo,length(goo)-1)
  24.  
  25. return goo
  26.  
  27.  
  28.