Opening a File by using a named pipe
Hi,
I am trying to use a function from ffmpeg library(A linux based decoder-encoder) This function has an input like "const char *filename" I am trying to call it with a buffer(unsigned char *buff) So, I created a pipe, and wrote my buffer to it: Code:
int my_pipe[2]; (An equivalent question can be, how to call `fopen` using a file descriptor?) |
I dont know if this is portable to other OSs, but it works in Linux.
Each process has its own directory, placed in /proc and named after its process ID (thus all the directories with numbers). Each process-dir has a directory named 'fd', which contains a list of all active file descriptors. /proc/self is a shortcut to the current process-dir (so it wont work to pass such a name between multiple processes, you would have to construct the actual name with the process ID). Simple make a filename using the above and the file descriptor, example: Code:
#include <stdio.h> |
All times are GMT -5. The time now is 11:01 AM. |