%FOPEN

%FOPEN


%FGETS Index Level %FPRINTF
Syntax stream = (char*)%FOPEN( string, type )
Category BASIC
Type C Function
Description opens the Unix file designated by "string" and associates a stream with it.

"type" is a character string having one of the following values:

"r"   Opens for reading only.

"w"   Truncates or creates for writing only.

"a"   Append; opens for writing at the end of file or creates for writing.

"r+"   Opens for update.

"w+"   Truncates or creates for update.

"a+"   Append; opens for writing at the end of file or creates for update.

The stream is returned as a pointer to a character or 0 if an error occurred. System(0) contains the error number.

Streams are not automatically closed at program termination.
Options
See Also c function %FDOPEN %FREOPEN CFUNCTION %FCLOSE %FGETC %FGETS %FPRINTF %FPUTC
Example stream=(char*)%fopen('/usr/pick/fname',"w+")
if stream=0 then
 crt 'Cannot open stream. errno=':system(0)
end
Warnings As of release 5.2.5, files are closed automatically when the FlashBASIC programs terminate.
Compatibility D3/Unix
%FGETS Index Level %FPRINTF