SilverScreen Solid Modeler

fopen

fopen

Previous topic Next topic  

fopen

Previous topic Next topic JavaScript is required for the print function  

StandardCLibrary

 

FILE *fopen( char *filename,char *mode )

 

char *filename;     /* name of disk file */

char *mode;         /* mode string */

 

 




Synopsis

#include "stdio.h"

 

The fopen function opens a stream associated with the file specified by filename for I/O, according the the value of mode .

 

 

Parameters

filename and mode are null-terminated strings. mode must contain exactly one of "r", "w" or "a", plus potentially a "+":

 

Mode

Meaning

"r"

open text stream for reading

"w"

open text stream for writing

"a"

open or create text stream for appending at end of file

"r+"

open text stream for reading and writing

"w+"

create stream for reading and writing; if the file exists already, its contents are erased

"a+"

open or create text stream for reading and writing; data is written at end of file

 

mode may also contain one or more of the following:

 

Flag

Meaning

"b"

binary stream

"t"

text stream

"u"

unbuffered stream

 

 

Return Value

fopen returns a non-NULL stream pointer if the file open succeeds, and NULL (0L) otherwise.

 

 

See Also

fclose , fseek