focus expression text field at startup -> version 1.2
[LeanCalc.git] / help / fgets
1 NAME
2     fgets - read the next line from a file, newline is kept
3
4 SYNOPSIS
5     fgets(fd)
6
7 TYPES
8     fd          file
9
10     return      str or nil
11
12 DESCRIPTION
13     This function reads the next line, including any trailing newline from
14     the open file associated with fd.  Unlike fgetline, the trailing
15     newline is included in the return string.
16
17     If a line is read, it is returned, otherwise (EOF or ERROR) nil is returned.
18
19 EXAMPLE
20     > fd = fopen("/tmp/newfile", "w")
21     > fputs(fd, "chongo was here\n")
22     > fd2 = fopen("/tmp/newfile", "r")
23     > fgets(fd2)
24             "chongo was here
25     "
26
27     > fclose(fd2)
28     > fd2 = fopen("/tmp/newfile", "r")
29     > fgetline(fd2)
30             "chongo was here"
31
32 LIMITS
33     fd must be associated with an open file
34
35 LINK LIBRARY
36     none
37
38 SEE ALSO
39     errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
40     fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
41