fopen
- Updated2023-02-21
- 2 minute(s) read
FILE *fopen (const char fileName[], const char mode[]);
Purpose
Opens the specified file according to the designated mode. If successful, fopen returns a pointer to the opened stream. When an error occurs, fopen returns NULL and sets errno to a nonzero value.
Parameters
Input | ||||||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||||||
fileName | const char [] | Specifies the name of the file to open. Relative pathnames are valid only if relative to the current working directory.
|
||||||||||||||||||||||||||
mode | const char [] |
Specifies the mode of reading and writing for the opened file.
The possible modes are listed in the following chart:
|
Return Value
Name | Type | Description |
stream | FILE * | Contains a pointer to the I/O stream associated with the opened file when the file is successfully opened. When an error occurs, fopen returns NULL and sets errno to a nonzero value. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later