Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

pclose <int>

pclose is undoable, queryable, and editable.

This command closes a pipe opened with popen and returns zero on success or not zero if an error occurred.

Return value

int

In query mode, return type is based on queried flag.

Related

fclose, feof, fflush, fgetline, fgetword, fopen, fprint, fread, frewind, fwrite, popen

MEL examples

// Unix specific example.  Note: if you really want to get a directory
// listing, please use the "getFileList" command instead.  This is just
// used as a simple example.
//
$pipe = popen( "ls -1", "r" );
string $dirList[];
while ( !feof( $pipe ) ) {
    $dirList[size( $dirList )] = fgetline( $pipe );
}
pclose( $pipe );

// Windows specific example.  Note: if you really want to get a directory
// listing, please use the "getFileList" command instead.  This is just
// used as a simple example.
//
$pipe = popen( "DIR /B", "r" );
string $dirList[];
while ( !feof( $pipe ) ) {
    $dirList[size( $dirList )] = fgetline( $pipe );
}
pclose( $pipe );