home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3s / getc.z / getc
Encoding:
Text File  |  2002-10-03  |  5.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GGGGEEEETTTTCCCC((((3333SSSS))))                                                              GGGGEEEETTTTCCCC((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      getc, getchar, fgetc, getw, getc_unlocked, getchar_unlocked - get
  10.      character or word from a stream
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  14.  
  15.      iiiinnnntttt ggggeeeettttcccc ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  16.  
  17.      iiiinnnntttt ggggeeeettttcccchhhhaaaarrrr ((((vvvvooooiiiidddd))));;;;
  18.  
  19.      iiiinnnntttt ffffggggeeeettttcccc ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  20.  
  21.      iiiinnnntttt ggggeeeettttwwww ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  22.  
  23.      iiiinnnntttt ggggeeeettttcccc____uuuunnnnlllloooocccckkkkeeeedddd ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  24.  
  25.      iiiinnnntttt ggggeeeettttcccchhhhaaaarrrr____uuuunnnnlllloooocccckkkkeeeedddd ((((vvvvooooiiiidddd))));;;;
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      _F_g_e_t_c and _g_e_t_c return the next character (if it exists) from the named
  29.      input _s_t_r_e_a_m, as an unsigned character converted to an integer.  It also
  30.      moves the file pointer, if defined, ahead one character in _s_t_r_e_a_m.
  31.      _g_e_t_c_h_a_r is defined as _g_e_t_c(_s_t_d_i_n).  Each of _g_e_t_c,_g_e_t_c_h_a_r and _f_g_e_t_c exist
  32.      as functions in the C library. _G_e_t_c and _g_e_t_c_h_a_r are also available as
  33.      macros in <_s_t_d_i_o._h> (see below under CAVEATS for important details on the
  34.      implementation of these macros.)
  35.  
  36.      _G_e_t_w returns the next word (i.e., integer) from the named input _s_t_r_e_a_m.
  37.      _G_e_t_w increments the associated file pointer, if defined, to point to the
  38.      next integer-sized word.  _G_e_t_w assumes no special alignment in the file.
  39.  
  40.      The _g_e_t_c__u_n_l_o_c_k_e_d and _g_e_t_c_h_a_r__u_n_l_o_c_k_e_d functions are equivalent to the
  41.      _g_e_t_c and _g_e_t_c_h_a_r functions, respectively.  However, these functions are
  42.      not thread-safe and thus must only be called under the protection of the
  43.      _f_l_o_c_k_f_i_l_e (or _f_t_r_y_l_o_c_k_f_i_l_e) and _f_u_n_l_o_c_k_f_i_l_e functions.
  44.  
  45. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  46.      fclose(3S), ferror(3S), fopen(3S), fread(3S), gets(3S), putc(3S),
  47.      scanf(3S), stdio(3S), ungetc(3S).
  48.  
  49. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  50.      These functions return the constant EEEEOOOOFFFF at end-of-file or upon an error.
  51.      Because EEEEOOOOFFFF is a valid integer, it is not sufficient to detect _g_e_t_w
  52.      errors.  _f_e_r_r_o_r(3S) must be used as well.
  53.  
  54. WWWWAAAARRRRNNNNIIIINNNNGGGG
  55.      If the integer value returned by _g_e_t_c, _g_e_t_c_h_a_r, or _f_g_e_t_c is stored into a
  56.      character variable and then compared against the integer constant EEEEOOOOFFFF,
  57.      the comparison may never succeed, because sign-extension of a character
  58.      on widening to integer is machine-dependent.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GGGGEEEETTTTCCCC((((3333SSSS))))                                                              GGGGEEEETTTTCCCC((((3333SSSS))))
  71.  
  72.  
  73.  
  74. CCCCAAAAVVVVEEEEAAAATTTTSSSS
  75.      When using the macro versions of _g_e_t_c and _g_e_t_c_h_a_r, the _s_t_r_e_a_m argument
  76.      may be evaluated more than once.  Thus, it must not be an expression with
  77.      side-effects.  In particular, ggggeeeettttcccc((((****ffff++++++++)))) does not work sensibly.  In
  78.      these situations, the macro must either be ####uuuunnnnddddeeeeffff'd, or _f_g_e_t_c should be
  79.      used instead.
  80.  
  81.      Because of possible differences in word length and byte ordering, files
  82.      written using _p_u_t_w are machine-dependent, and may not be read using _g_e_t_w
  83.      on a different processor.
  84.  
  85. BBBBUUUUGGGGSSSS
  86.      When using the macros for _g_e_t_c and _g_e_t_c_h_a_r, hidden external names may be
  87.      referenced. Although these names are prefixed with an underscore, they
  88.      may conflict with names which the ANSI C Standard reserves for the user
  89.      when appearing in a local context.  It is thus recommended that users of
  90.      these macros reserve all names which begin with an underscore for the
  91.      implementation, and avoid defining such names, even in a local context.
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.