sl@0: /* GETC.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: <>---read a character (macro) sl@0: sl@0: INDEX sl@0: getc sl@0: sl@0: ANSI_SYNOPSIS sl@0: #include sl@0: int getc(FILE *<[fp]>); sl@0: sl@0: TRAD_SYNOPSIS sl@0: #include sl@0: int getc(<[fp]>) sl@0: FILE *<[fp]>; sl@0: sl@0: DESCRIPTION sl@0: <> is a macro, defined in <>. You can use <> sl@0: to get the next single character from the file or stream sl@0: identified by <[fp]>. As a side effect, <> advances the file's sl@0: current position indicator. sl@0: sl@0: For a subroutine version of this macro, see <>. sl@0: sl@0: RETURNS sl@0: The next character (read as an <>, and cast to sl@0: <>), unless there is no more data, or the host system reports a sl@0: read error; in either of these situations, <> returns <>. sl@0: sl@0: You can distinguish the two situations that cause an <> result by sl@0: using the <> and <> functions. sl@0: sl@0: PORTABILITY sl@0: ANSI C requires <>; it suggests, but does not require, that sl@0: <> be implemented as a macro. The standard explicitly permits sl@0: macro implementations of <> to use the argument more than once; sl@0: therefore, in a portable program, you should not use an expression sl@0: with side effects as the <> argument. sl@0: sl@0: Supporting OS subroutines required: <>, <>, <>, sl@0: <>, <>, <>, <>. sl@0: */ sl@0: sl@0: #include sl@0: #include "LOCAL.H" sl@0: sl@0: /* sl@0: * A subroutine version of the macro getc. sl@0: */ sl@0: sl@0: #undef getc sl@0: sl@0: /** sl@0: Get the next character. sl@0: Returns the next character of the stream and increases the file pointer sl@0: to point to the next character. sl@0: @return The character read is returned as an int value. sl@0: If the End Of File has been reached or there has been an error reading, sl@0: the function returns EOF. sl@0: @param fp pointer to an open file. sl@0: */ sl@0: EXPORT_C int sl@0: getc (register FILE *fp) sl@0: { sl@0: /* CHECK_INIT is called (eventually) by __srefill. */ sl@0: sl@0: return __sgetc (fp); sl@0: }