luaposix 33.3.0 Reference

# Module `posix.stdio`

A few Standard I/O functions not already in Lua core.

## Functions

ctermid () | Name of controlling terminal.
fdopen (fd) | Create a Lua file object from a file descriptor.
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:

  ctermid(3)
fdopen (fd)
  Create a Lua file object from a file descriptor.

  ### Parameters:

  - fd int file descriptor

  ### Returns:

  file file Lua file object fd, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### Usage:

      stdout = P.fdopen (posix.STDOUT_FILENO)

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

  1. nil
  2. string error message
  3. 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

generated by LDoc 1.4.3 Last updated 2015-03-01 09:06:02