Go to: Synopsis. Return value. Related. MEL examples.
fopen [string] string
fopen is NOT undoable, NOT queryable, and NOT editable.
This command defaults to opening a file for writing and returns a file identifier. The optional mode string may be one of the following:int | File id |
// Open a file for writing, the default behavior of the command // $exampleFileName = ( `internalVar -userTmpDir` + "example.tmp" ); $fileId=`fopen $exampleFileName`; fprint $fileId "Hello there\n"; fclose $fileId; // OR // Do the same as above, but include the "w" argument to explicitly // say that we wish to open the file for writing // $exampleFileName = ( `internalVar -userTmpDir` + "example.tmp" ); $fileId=`fopen $exampleFileName "w"`; fprint $fileId "Hello there\n"; fclose $fileId;