Command: gets
  
Syntax: 
  x = gets(fn)
  
Description: 
  Get the next sequence (one line, including '\n') of characters 
  from file or device fn. The characters will have values from 0 
  to 255. The atom -1 is returned on end of file. 
  
Comments: 
  Because either a sequence or an atom (-1) might be returned, you 
  should probably assign the result to a variable declared as 
  object.
  
  The last line in a file might not end with a new-line '\n' 
  character.
  
Example 1:

      sequence buffer
      object line
              integer fn
      
      -- read a text file into a sequence
      fn = open("myfile.txt", "r")
      if fn = -1 then
        puts(1, "Couldn't open myfile.txt\n")
          abort(1)
      end if
      
      buffer = {}
      while 1 do
       line = gets(fn)
       if atom(line) then
      exit   -- -1 is returned at end of file
       end if
       buffer = append(buffer, line)
      end while

Example 2:

              object line
              
              puts(1, "What is your name?\n")
              line = gets(0)  -- read standard input (keyboard)
              line = line[1..length(line)-1] -- get rid of \n character at end
              puts(1, '\n')   -- necessary
              puts(1, line & " is a nice name.\n")
 
See Also: 
  getc, puts, open
  
