lua-users home
lua-l archive

Re: C string as 'file' object

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great ernie once stated:
> Is there an easy way to make a C string look like a read-only file 
> object (file:lines(), file:read(), file:seek())? Might not be too much 
> to implement from scratch, but wondering if someone's already seen this.
 If you are using a system with the GNU C library, you can call fmemopen(),
which creates a FILE* object from memory. You can read a man page here:
	http://linux.die.net/man/3/open_memstream
 -spc

AltStyle によって変換されたページ (->オリジナル) /