[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: C string as 'file' object
- From: Sean Conner <sean@...>
- Date: Sat, 24 Mar 2012 00:27:50 -0400
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