Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
putc, putc_unlocked - put byte on stream
&pagelevel(4)&pagelevel
Syntax | #include <stdio.h> int putc(int c, FILE *stream); int putc_unlocked(int c, FILE *stream); |
Description | The function putc() is equivalent to fputc() , but is defined as a macro and a function. When it is used as a macro, it may evaluate c and stream more than once, so these argument should never be an expression with side-effects. The function putc_unlocked() (see "getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - standard I/O with explicit lock by the client" under getc_unlocked( ) ...) is functionally equivalent to putc() except that it’s implementation is not thread-safe. For this reason it can only be used safely in a multithreaded program if the thread that calls it owns the corresponding (FILE *) object. This is the case after successfully calling the flockfile() or ftrylockfile() functions. |
Return val. | See fputc() . |
Errors | See fputc() . |
Notes | If putc() is used as a macro, it may handle the arguments c and stream with side-effects incorrectly. putc( c, * f++) , in particular, will usually not work correctly. It is therefore advisable to use fputc() instead. The bytes are not written immediately to the external file but are stored in an internal C buffer (see section “Buffering streams”). The program environment determines whether putc() is executed for a BS2000 or POSIX file. BS2000 Control characters for white space (\n , \t , etc.) are converted to their appropriate effect when output to text files, depending on the type of text file (see section “White-spacecharacters”). (End) |
See also | fputc() , getc_unlocked() , stdio.h .
|