popen is used to read and write to a unix pipe.
This function is NOT included in 'C Programming Language' (ANSI) but can be found in 'The Standard C Library' book.
Library: stdio.h Prototype: FILE *popen(const char *command, const char *type); Syntax: FILE *fp; fp = popen( "ls -l", "r"); Notes: command - is the command to be issued. type - r - read O/P from command. - w - Write data as I/P to command.
fp=popen("ls -l 2>&1", "w"); AAAA ||||