putc
- Updated2023-02-21
- 1 minute(s) read
putc
int putc (int character, FILE *stream);
Purpose
Writes the specified character to an output stream at the position of the associated file position indicator. The indicator will be advanced appropriately. If successful, the function will return the character written; otherwise, the function returns EOF (-1).
![]() |
Note If the file cannot support positioning requests, or if the stream was opened with append mode, the character is appended to the output stream. This function is equivalent to fputc, except that if implemented as a macro, it may evaluate the stream more than once. Therefore, the argument should never be an expression with side effects. |
Parameters
Input | ||
Name | Type | Description |
character | int | Contains the character written to the standard output. The input must be a character with integer value between 0 and 255. |
stream | FILE * | Contains a pointer to the output stream where the specified character is written. |
Return Value
Name | Type | Description |
characterWritten | int | Contains the character written. If an error occurs, putc sets the error indicator for the stream, 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