home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / doc / gets.n < prev    next >
Text File  |  1993-10-04  |  3KB  |  62 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/gets.n,v 1.2 93/10/04 16:01:09 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS gets tcl
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. gets \- Read a line from a file
  29. .SH SYNOPSIS
  30. \fBgets \fIfileId\fR ?\fIvarName\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. This command reads the next line from the file given by \fIfileId\fR
  36. and discards the terminating newline character.
  37. If \fIvarName\fR is specified then the line is placed in the variable
  38. by that name and the return value is a count of the number of characters
  39. read (not including the newline).
  40. If the end of the file is reached before reading
  41. any characters then \-1 is returned and \fIvarName\fR is set to an
  42. empty string.
  43. If \fIvarName\fR is not specified then the return value will be
  44. the line (minus the newline character) or an empty string if
  45. the end of the file is reached before reading any characters.
  46. An empty string will also be returned if a line contains no characters
  47. except the newline, so \fBeof\fR may have to be used to determine
  48. what really happened.
  49. If the last character in the file is not a newline character then
  50. \fBgets\fR behaves as if there were an additional newline character
  51. at the end of the file.
  52. \fIFileId\fR must be \fBstdin\fR or the return value from a previous
  53. call to \fBopen\fR; it must refer to a file that was opened
  54. for reading.
  55. .VS
  56. Any existing end-of-file or error condition on the file is cleared at
  57. the beginning of the \fBgets\fR command.
  58. .VE
  59.  
  60. .SH KEYWORDS
  61. file, line, read
  62.