fgetc, fgets, getc, getchar, ungetc - input of characters and strings


   #include <stdio.h>

   int fgetc(FILE *stream);

   char *fgets(char *s, int size, FILE *stream);

   int getc(FILE *stream);

   int getchar(void);

   int ungetc(int c, FILE *stream);


   fgetc()  reads  the  next  character  from  stream and returns it as an
   unsigned char cast to an int, or EOF on end of file or error.

   getc() is equivalent to fgetc() except that it may be implemented as  a
   macro which evaluates stream more than once.

   getchar() is equivalent to getc(stdin).

   fgets()  reads in at most one less than size characters from stream and
   stores them into the buffer pointed to by s.  Reading  stops  after  an
   EOF  or a newline.  If a newline is read, it is stored into the buffer.
   A terminating null byte ('\0') is stored after the  last  character  in
   the buffer.

   ungetc()  pushes  c  back to stream, cast to unsigned char, where it is
   available for subsequent read operations.  Pushed-back characters  will
   be returned in reverse order; only one pushback is guaranteed.

   Calls  to the functions described here can be mixed with each other and
   with calls to other input functions from the stdio library for the same
   input stream.

   For nonlocking counterparts, see unlocked_stdio(3).


   fgetc(),  getc() and getchar() return the character read as an unsigned
   char cast to an int or EOF on end of file or error.

   fgets() returns s on success, and NULL on error or  when  end  of  file
   occurs while no characters have been read.

   ungetc() returns c on success, or EOF on error.


   For   an   explanation   of   the  terms  used  in  this  section,  see

   │InterfaceAttributeValue   │
   │fgetc(), fgets(), getc(), │ Thread safety │ MT-Safe │
   │getchar(), ungetc()       │               │         │


   POSIX.1-2001, POSIX.1-2008, C89, C99.

   It is not advisable to mix calls to  input  functions  from  the  stdio
   library  with  low-level  calls  to  read(2)  for  the  file descriptor
   associated with the input stream; the results  will  be  undefined  and
   very probably not what you want.


   read(2), write(2), ferror(3), fgetwc(3), fgetws(3), fopen(3), fread(3),
   fseek(3),  getline(3),   gets(3),   getwchar(3),   puts(3),   scanf(3),
   ungetwc(3), unlocked_stdio(3), feature_test_macros(7)


   This  page  is  part of release 4.09 of the Linux man-pages project.  A
   description of the project, information about reporting bugs,  and  the
   latest     version     of     this    page,    can    be    found    at

More Linux Commands

tack(1) - terminfo action checker - Linux manual page.......
The tack program has three purposes: 411toppm(1) to help you build a new terminfo entry describing an unknown terminal, 411toppm(1) to test the correctness of a

fread(3) - binary stream input/output - Linux manual page...
The function fread() reads nmemb elements of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr. The fu

FcFreeTypeCharSet(3) - compute unicode coverage (Man Page)
FcFreeTypeCharSet.3 - Scans a FreeType face and returns the set of encoded Unicode chars. This scans several encoding tables to build as complete a list as poss

pam_setcred(3) - establish / delete user credentials........
The pam_setcred function is used to establish, maintain and delete the credentials of a user. It should be called to set the credentials after a user has been a

Net::LDAP::Extra(3pm) - Load extra Net::LDAP methods........
Net::LDAP::Extra allows extra methods to be added to Net::LDAP. Normally such methods would be added by sub-classing Net::LDAP, but this proves to get messy as

Tcl_FreeParse(3) - parse Tcl scripts and expressions........
These procedures parse Tcl commands or portions of Tcl commands such as expressions or references to variables. Each procedure takes a pointer to a script (or p

XDGAKeyEventToXKeyEvent(3) - Client library for the XFree86-
The XFree86-DGA extension is an X server extension for allowing client programs direct access to the video frame buffer. This is a brief description of the prog

nop(1) - pretty-print graph file (Commands - Linux man page)
nop reads a stream of graphs and prints each in pretty-printed (canonical) format on stdout. If no files are given, it reads from stdin. OPTIONS The following o

html2textrc(5) formatting properties file for html2text(1)
The html2textrc(5) file defines a set of formatting properties used by the html2text(1) utility, that overrides the programs built-in formatting defaults. Each

journalctl(1) Query the systemd journal - Linux manual page
journalctl may be used to query the contents of the systemd(1) journal as written by systemd-journald.service(8). If called without parameters, it will show the

ldap_str2matchingrule(3) - Schema definition handling routin
These routines are used to parse schema definitions in the syntax defined in RFC 4512 into structs and handle these structs. These routines handle four kinds of

XtGetConstraintResourceList(3) - obtain resource list.......
If XtGetResourceList is called before the widget class is initialized (that is, before the first widget of that class has been created), XtGetResourceList retur

We can't live, work or learn in freedom unless the software we use is free.