ne_get_range directly to char array buffer

Jordi Mueters jordimueters at hotmail.com
Tue Apr 11 10:09:49 EDT 2017


Unfortunately I can't do that. fileno returns -1 when you request the file descriptor of a FILE created by fmemopen.

Quote from the Linux Programmer's Manual:


There is no file descriptor associated with the file stream returned
by this function (i.e., fileno(3) will return an error if called on
the returned stream).


________________________________
Van: Henrik Holst <henrik.holst at millistream.com>
Verzonden: dinsdag 11 april 2017 16:07:53
Aan: Jordi Mueters
CC: neon at lists.manyfish.co.uk
Onderwerp: Re: ne_get_range directly to char array buffer

Hi,

  you can use fileno(3) in order to get the filedescriptor from a FILE pointer. "int fileno(FILE *stream);"

/HH

2017-04-11 15:40 GMT+02:00 Jordi Mueters <jordimueters at hotmail.com<mailto:jordimueters at hotmail.com>>:

Hi all, hope someone can help me with the following.

I am using ne_get_range to read part of a file on webdav.

This method requires a file descriptor.


I, however, have no interest in reading into an actual file, I want the content to stay in memory (preferably directly written directly into a char array I manage).

My thinking is that I can create a pointer to a FILE using  fmemopen. Unfortunately fmemopen returns a FILE which does not have a file descriptor.


The proposal is to overload ne_get_range to accept a FILE pointer instead of a file descriptor. This won't break any functionality because I'm sure everyone has to call fileno to get the filedescriptor anyways and with the change they don't have to anymore.


If anyone has a more suitable solution (to read the range directly into my char array) please let me know.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.manyfish.co.uk/pipermail/neon/attachments/20170411/b849ce66/attachment.html 


More information about the neon mailing list