virtual c file descriptor
3 replies to this topic
Members - Reputation: 509
Posted 01 December 2012 - 01:13 PM
I have a library that takes a file descriptor to read from but im trying to make it read from a http location and the only way I can think of to do such is to create a virtual file and handle all the http overhead myself but I cant find anything that remotely hints over riding a file descriptor is possible. So is it possible if so is there any tutorials?
Moderators - Reputation: 8489
Posted 01 December 2012 - 01:42 PM
On most operating systems that use file descriptors you can create a pipe, which will give you a readable and a writable file descriptor. You can then pass the readable file descriptor to functions that require file descriptors and write arbitrary data to the writable file descriptor.