Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-143
putc
putc
The putc function writes a character to a file opened for ANSI I/O.
character
specifies the character to be written.
stream
denotes a file opened for ANSI I/O.
Return Value
is the character written if the operation is successful; otherwise, putc returns the
value EOF.
Usage Guidelines
•
The putc function might be implemented as a macro in a future release.
Consequently, you should use fputc rather than putc if you are concerned about the
amount of memory in the macro expansion or about side effects.
•
When using putc to write to an Edit file, you must terminate each line with a
newline character. Between newline characters you can write up to 239 characters,
which is the maximum length of a line for Edit files.
Example
In this example, the putc function writes the letter “a” to $a.b.c:
#include <stdioh>
FILE *fp;
int status;
int c;
fp = fopen("$a.b.c ", "w");
c = 'a';
/* ... */
status = putc(c, fp);
#include <stdioh>
int putc(int character, FILE *stream);