D
Daniel Berger
Hi
According to the man page, the prototypes for getutxent(), setutxent()
and endutxent() are as follows:
void endutxent(void);
struct utmpx * getutxent(void);
void setutxent(void);
So, I declared them like so:
require 'ffi'
class Info
extend FFI::Library
attach_function :setutxent, [], :void
attach_function :getutxent, [],
ointer
attach_function :endutxent, [], :void
def self.getstuff
begin
setutxent()
p getutxent() # NULL Pointer ???
ensure
endutxent()
end
end
end
Info.getstuff # Null Pointer object
However, the call to getutxent() returns a NULL pointer. I'm guessing I
have to tell it what kind of pointer to return, but I wasn't sure how to
do that. How do I do that?
Regards,
Dan
According to the man page, the prototypes for getutxent(), setutxent()
and endutxent() are as follows:
void endutxent(void);
struct utmpx * getutxent(void);
void setutxent(void);
So, I declared them like so:
require 'ffi'
class Info
extend FFI::Library
attach_function :setutxent, [], :void
attach_function :getutxent, [],
attach_function :endutxent, [], :void
def self.getstuff
begin
setutxent()
p getutxent() # NULL Pointer ???
ensure
endutxent()
end
end
end
Info.getstuff # Null Pointer object
However, the call to getutxent() returns a NULL pointer. I'm guessing I
have to tell it what kind of pointer to return, but I wasn't sure how to
do that. How do I do that?
Regards,
Dan