# (read-line \[file-descriptor\]) [GstarCAD 2012](../../../Index.md) → [Developer Reference](../../%28Developer%20Reference%29.md) → [AutoLISP Reference](../%28AutoLISP%20Reference%29.md) → [LISP Functions](%28LISP%20Functions%29.md) <a id="251"></a> ## (read-line \[file-descriptor\]) --- Read a whole line. --- The **read-line** function is similar to the [read-char](%28read-char%20-file-descriptor-%29.md) function, but is generally much more practical and efficient to use. Anything can be read from a file, since the format is a string. The file is specified by the *file-desc*, assigned by the open(open filename mode)(IDR\_237) function. **Example** For the following example, assume the file *sample.lsp* exists, the first line is "C:\\Sample\\First.txt", and the second line is "Second Line". | Code | Returns | | --- | --- | | (setq file (open "sample.lsp" "r")) | | | (setq c (**read-line** file)) | "C:\\\\Sample\\\\First.txt" | | (setq d (**read-line** file)) | "Second Line" | ### NOTES - The **read-line** function automatically moves to the next line in the file; it returns the *next* line from the file. - When **read-line** reaches the end of the file, it returns **nil**. **Tell me about...** [(setq symbol1 statement1 \[symbol2 statement2\] ...)](%28setq%20symbol1%20statement1%20-symbol2%20statement2-%20...%29.md) [(write-line string \[file-descriptor\])](%28write-line%20string%20-file-descriptor-%29.md) [LISP Compatibility](../LISP%20Compatibility.md) [Programming Overview of LISP (LISt Processing) Language](../Programming%20Overview%20of%20LISP%20%28LISt%20Processing%29%20Language.md) <a id="holding"></a> ## Other versions with matching text [GstarCAD 2011](../../../../2011/Developer%20Reference/AutoLISP%20Reference/LISP%20Functions/%28read-line%20-file-descriptor-%29.md)