popen read and write

버전 1.0.0.0 (112 KB) 작성자: Dan Ellis
MEX source to acccess popen r/w
다운로드 수: 2.8K
업데이트 날짜: 2007/2/5

라이선스 보기

popen() -- for "pipe open" -- is a very useful system call provided in many flavors of Unix. It runs a command passed in as a string then returns a file handle so that the parent process can read or write to the process as if it was a file; data passed this way is connected to the standard input or the standard output of the child process.

I created this because I wanted to process very long MP3 files in Matlab. Originally I wrote mp3read to allow me to decode just a small section of a long MP3 file without having to decode the whole thing, but every time I wanted to read another segment, I had to open the file again, then seek through to the point I wanted to read.

Instead, by using popen to open an MP3 decoding process that writes to standard output, I can "pull" as many frames as I want from the file, then put the process to sleep while I deal with those frames, then, on my next read from popen, the process is reawoken and the next block of data can be accessed. But this could be used for any application where there are long data streams to read or write, and you want to handle them a bit at a time.

Two functions are provided, popenr.c for reading from command pipes, and popenw.w for writing to command pipes. Reading and writing to the same command is not supported at present.

인용 양식

Dan Ellis (2024). popen read and write (https://www.mathworks.com/matlabcentral/fileexchange/13851-popen-read-and-write), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2006b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

popenmatlab/html/

버전 게시됨 릴리스 정보
1.0.0.0