[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Printing to terminal/standard output problem
- From: PooshhMao <pooshhmao@...>
- Date: Sun, 20 Nov 2011 20:17:12 +0100
Thanks for your reply! I'm eager to learn more about the use of FFI.
However when I try to run your example I get the error: declaration
specifier expected near 'FILE'
On 11/20/2011 05:20 PM, Francesco Abbate wrote:
I cannot resist to the temptations, this can be done so easily with
the FFI module :-)
local ffi = require('ffi')
extern FILE *stdin;
int isatty(int FILEDES);
int fileno (FILE *STREAM);
local fd = ffi.C.fileno(ffi.C.stdin)
Please note that the use of "fileno" can be avoided if you assume that
the file descriptor of stdin is 0. This is always true on linux.