#include <lua/fcntl.lh>
- handle = rawio.open(filename [, mode])
- handle = rawio.attach(fd)
Both functions return a rawio handle instance for use with other rawio functions. rawio.open() opens the file or device at filename, while rawio.attach() initializes a handle from an already open file descriptor.
The optional mode parameter consists of the logical or of one access mode and optional flags. The default is O_RDWR | O_CREAT.
Access modes | |
---|---|
O_RDONLY | Open file for reading. |
O_WRONLY | Open file for writing. |
O_RDWR | Open for both reading and writing. |
Flags | |
---|---|
O_CREAT | If the file does not exist, it will be created. |
O_TRUNC | If the file already exists, it is truncated to zero length. |
O_APPEND | Before each write, the file pointer is placed at the end of the file. |
O_NONBLOCK | The file is opened in nonblocking mode. No subsequent operation on the open file will cause the calling process to wait. Instead, all functions that would cause a wait will instead return an error indicating that condition. This flag must be set if the file handle is to be used with an event loop, or your application might suffer from unexpected lockups. |
O_SILENT | Only useful for serial ports. When set, the control signals CTS and DTR are not initialized after opening the port, but left in the state they where before. This flag is Core4 kernel specific. |
Opening the second serial port.
A somewhat obfuscated way of saying hello.