sl@0: /* PUTC.C sl@0: * sl@0: * Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: /* sl@0: * Copyright (c) 1990 The Regents of the University of California. sl@0: * All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms are permitted sl@0: * provided that the above copyright notice and this paragraph are sl@0: * duplicated in all such forms and that any documentation, sl@0: * advertising materials, and other materials related to such sl@0: * distribution and use acknowledge that the software was developed sl@0: * by the University of California, Berkeley. The name of the sl@0: * University may not be used to endorse or promote products derived sl@0: * from this software without specific prior written permission. sl@0: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR sl@0: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED sl@0: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. sl@0: */ sl@0: sl@0: /* sl@0: FUNCTION sl@0: <<putc>>---write a character (macro) sl@0: sl@0: INDEX sl@0: putc sl@0: sl@0: ANSI_SYNOPSIS sl@0: #include <stdio.h> sl@0: int putc(int <[ch]>, FILE *<[fp]>); sl@0: sl@0: TRAD_SYNOPSIS sl@0: #include <stdio.h> sl@0: int putc(<[ch]>, <[fp]>) sl@0: int <[ch]>; sl@0: FILE *<[fp]>; sl@0: sl@0: DESCRIPTION sl@0: <<putc>> is a macro, defined in <<stdio.h>>. <<putc>> sl@0: writes the argument <[ch]> to the file or stream identified by sl@0: <[fp]>, after converting it from an <<int>> to an <<unsigned char>>. sl@0: sl@0: If the file was opened with append mode (or if the stream cannot sl@0: support positioning), then the new character goes at the end of the sl@0: file or stream. Otherwise, the new character is written at the sl@0: current value of the position indicator, and the position indicator sl@0: advances by one. sl@0: sl@0: For a subroutine version of this macro, see <<fputc>>. sl@0: sl@0: RETURNS sl@0: If successful, <<putc>> returns its argument <[ch]>. If an error sl@0: intervenes, the result is <<EOF>>. You can use `<<ferror(<[fp]>)>>' to sl@0: query for errors. sl@0: sl@0: PORTABILITY sl@0: ANSI C requires <<putc>>; it suggests, but does not require, that sl@0: <<putc>> be implemented as a macro. The standard explicitly permits sl@0: macro implementations of <<putc>> to use the <[fp]> argument more than once; sl@0: therefore, in a portable program, you should not use an expression sl@0: with side effects as this argument. sl@0: sl@0: Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, sl@0: <<lseek>>, <<read>>, <<sbrk>>, <<write>>. sl@0: */ sl@0: sl@0: #include <stdio_r.h> sl@0: #include "LOCAL.H" sl@0: sl@0: /* sl@0: * A subroutine version of the macro putc. sl@0: */ sl@0: sl@0: #undef putc sl@0: sl@0: EXPORT_C int sl@0: putc (int c,register FILE *fp) sl@0: { sl@0: /* CHECK_INIT is (eventually) called by __swbuf. */ sl@0: sl@0: return __sputc (c, fp); sl@0: }