FGETC man page on Plan9

Man page or keyword search:  
man Server   549 pages
apropos Keyword Search (all sections)
Output format
Plan9 logo
[printable version]

FGETC(2)							      FGETC(2)

NAME
       fgetc, getc, getchar, fputc, putc, putchar, ungetc, fgets, gets, fputs,
       puts, fread, fwrite - Stdio input and output

SYNOPSIS
       #include <u.h>
       #include <stdio.h>

       int  fgetc(FILE *f)

       int  getc(FILE *f)

       int  getchar(void)

       int  fputc(int c, FILE *f)

       int  putc(int c, FILE *f)

       int  putchar(int c)

       int  ungetc(int c, FILE *f)

       char *fgets(char *s, int n, FILE *f)

       char *gets(char *s)

       int  fputs(char *s, FILE *f)

       int  puts(char *s)

       long fread(void *ptr, long itemsize, long nitems, FILE *stream)

       long fwrite(void *ptr, long itemsize, long nitems, FILE *stream)

DESCRIPTION
       The functions described here work on open Stdio streams (see fopen).

       Fgetc returns as an int the next unsigned char from input stream f.  If
       the  stream is at end-of-file, the end-of-file indicator for the stream
       is set and fgetc returns EOF.  If a read error occurs, the error	 indi‐
       cator  for the stream is set and fgetc returns EOF.  Getc is like fgetc
       except that it is implemented as a macro.  Getchar is like getc	except
       that it always reads from stdin.

       Ungetc  pushes  character  c back onto the input stream f.  The pushed-
       back character will be returned by  subsequent  reads  in  the  reverse
       order  of  their	 pushing.  A successful intervening fseek, fsetpos, or
       rewind on f discards any pushed-back characters for f.	One  character
       of  push-back  is guaranteed.  Ungetc returns the character pushed back
       (converted to unsigned char), or EOF if the operation  fails.   A  suc‐
       cessful call to ungetc clears the end-of-file indicator for the stream.
       The file position indicator for the stream after reading or  discarding
       all  pushed-back characters is the same as it was before the characters
       were pushed back.

       Fputc writes character c (converted to unsigned char) to output	stream
       f  at  the  position indicated by the position indicator for the stream
       and advances the indicator appropriately.  If the file  cannot  support
       positioning requests, or if the stream was opened with append mode, the
       character is appended to the output stream.  Fputc returns the  charac‐
       ter  written or EOF if there was a write error.	Putc is like fputc but
       is implemented as a macro.  Putchar is like putc except that it	always
       writes to stdout.

       All  other  input  takes place as if characters were read by successive
       calls to fgetc and all other output takes place as if  characters  were
       written by successive calls to fputc.

       Fgets  reads up to and including the next newline, but not past end-of-
       file or more than n-1 characters, from stream f into array s.   A  null
       character is written immediately after the last character read into the
       array (if any characters are read at all).  Fgets returns s if success‐
       ful, otherwise a null pointer.  Gets is similar to fgets except that it
       always reads from stdin and it discards	the  terminating  newline,  if
       any.   Gets  does not check for overflow of the receiving array, so its
       use is deprecated.

       Fputs writes the string s to  stream f, returning EOF if a write	 error
       occurred,  otherwise a nonnegative value.  The terminating null charac‐
       ter is not written.  Puts is the same, writing to stdout.

       Fread reads from the named input stream at most nitems of data of  size
       itemsize	 and  the  type	 of  *ptr  into	 a block beginning at ptr.  It
       returns the number of items actually read.

       Fwrite appends to the named output stream at most  nitems  of  data  of
       size  itemsize  and the type of *ptr from a block beginning at ptr.  It
       returns the number of items actually written.

SOURCE
       /sys/src/libstdio

SEE ALSO
       read(2), fopen(2), bio(2)

BUGS
       Stdio does not handle UTF or runes; use Bio instead.

								      FGETC(2)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net