LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

fclose

fclose

int fclose (FILE *stream);

Purpose

Flushes the specified I/O stream and closes the associated file. If there is any unwritten buffered data for the file, it is written out before the file is closed. Any unread buffered data is discarded. If the associated buffer was automatically allocated, it is deallocated.

Note Note   Because this function may flush the write buffer, it can return an error even when the file handle is valid. To avoid this possibility, call fflush before calling fclose.

Parameters

Input
Name Type Description
stream FILE * Contains a pointer to the I/O stream that will be closed.

Return Value

Name Type Description
status int Contains the status returned by the function. If the function succeeds, fclose returns 0. If an error occurs, fclose returns EOF 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

Example

Refer to userint\custctrl\cviogl\ogldemo.cws for an example of using the fclose function.

Was this information helpful?