Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Use a string as a FILE * stream in XS code

by dcmertens (Scribe)
on Aug 18, 2016 at 16:33 UTC ( [id://1170007]=note: print w/replies, xml ) Need Help??


in reply to Use a string as a FILE * stream in XS code

I'm curious about this, too, so I read up on the internet. The best answer, on Stack Overflow, basically says that you can set the file buffer to your own pointer, using setvbuf, but the file operations are then free to do whatever they want with the contents of that memory. One of the answerers suggests that the poster should complain to the original library owner to add additional functions that take arrays. So, it seems you would do best to revise your library.
  • Comment on Re: Use a string as a FILE * stream in XS code

Replies are listed 'Best First'.
Re^2: Use a string as a FILE * stream in XS code
by Anonymous Monk on Aug 18, 2016 at 22:08 UTC

    (OP here)

    I went with the fmemopen/open_memstream route.

    They seem to do what I want without too much trouble, and I can live with the fact that they aren't portable - the library itself is pretty much Linux-only at this point.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1170007]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-23 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found