Shiny Language Reference

Language Reference > File Functions


fopen

bool fopen(file FileVar, string FileName);

 

 

Opens a file from a local drive

The FOPEN statement opens a file stored on a local drive and associates it with a FILE variable. The file can then be accessed.

 

Parameters

FileVar

A variable declared as type FILE, which will be associated with the opened file and used for all access to it.

FileName

The full path and filename of the file to open. If a string constant is being passed, remember to escape all backslashes.

 

Return Value

TRUE if opening the file suceeded, otherwise FALSE. The return value of FOPEN can be used for further operations.

 

Example Code

file myfile;
bool Result = fopen(myfile, "C:\\Readme.txt");

// Alternative testing:
if(fopen(myfile, "C:\\Readme.txt") == FALSE)
    // handle error