Module posix.stdio
A few Standard I/O functions not already in Lua core.
Functions
ctermid () | Name of controlling terminal. |
fileno (file) | File descriptor corresponding to a Lua file object. |
Constants
posix.stdio | Stdio constants. |
Functions
- ctermid ()
-
Name of controlling terminal.
Returns:
-
string
controlling terminal for current process
See also:
- fileno (file)
-
File descriptor corresponding to a Lua file object.
Parameters:
- file file Lua file object
Returns:
-
int
file descriptor for file, if successful
Or
- nil
- string error message
- int errnum
Usage:
STDOUT_FILENO = P.fileno (io.stdout)
Constants
- posix.stdio
-
Stdio constants.
Any constants not available in the underlying system will be
nil
valued.Fields:
- _IOFBF int fully buffered
- _IOLBF int line buffered
- _IONBF int unbuffered
- BUFSIZ int size of buffer
- EOF int end of file
- FOPEN_MAX int maximum number of open files
- FILENAME_MAX int maximum length of filename
Usage:
-- Print stdio constants supported on this host. for name, value in pairs (require "posix.stdio") do if type (value) == "number" then print (name, value) end end