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 / putc.z / putc
Encoding:
Text File  |  2002-10-03  |  5.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4. PPPPUUUUTTTTCCCC((((3333SSSS))))                                                              PPPPUUUUTTTTCCCC((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      putc, putchar, fputc, putw, putc_unlocked, putchar_unlocked - put
  10.      character or word on a stream
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  14.  
  15.      iiiinnnntttt ppppuuuuttttcccc ((((iiiinnnntttt cccc,,,, FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  16.  
  17.      iiiinnnntttt ppppuuuuttttcccchhhhaaaarrrr ((((iiiinnnntttt cccc))));;;;
  18.  
  19.      iiiinnnntttt ffffppppuuuuttttcccc ((((iiiinnnntttt cccc,,,, FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  20.  
  21.      iiiinnnntttt ppppuuuuttttwwww ((((iiiinnnntttt wwww,,,, FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  22.  
  23.      iiiinnnntttt ppppuuuuttttcccc____uuuunnnnlllloooocccckkkkeeeedddd ((((iiiinnnntttt cccc,,,, FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  24.  
  25.      iiiinnnntttt ppppuuuuttttcccchhhhaaaarrrr____uuuunnnnlllloooocccckkkkeeeedddd ((((iiiinnnntttt cccc))));;;;
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      _F_p_u_t_c  _a_n_d  _p_u_t_c write the character _c onto the output stream indicated
  29.      by _s_t_r_e_a_m at the position indicated by the associated file pointer (if
  30.      defined), advancing this pointer to the next character position.  For
  31.      files which cannot be positioned, or which have been opened in append
  32.      mode (see _f_o_p_e_n(3s)), the character is appended to the output stream.
  33.      _p_u_t_c_h_a_r(_c) is defined as _p_u_t_c(_c, _s_t_d_o_u_t).  Each of these functions is
  34.      available in the C library.  In addition, _p_u_t_c and _p_u_t_c_h_a_r are macros
  35.      defined in <_s_t_d_i_o._h>.  (see below under CAVEATS for important details on
  36.      the implementation of these macros.)
  37.  
  38.      The function versions of _p_u_t_c and _p_u_t_c_h_a_r, as well as _f_p_u_t_c runs more
  39.      slowly than the corresponding macros, but they take less space per
  40.      invocation and the function name can be passed as an argument to another
  41.      function.
  42.  
  43.      _p_u_t_w writes the word (i.e. integer) _w to the output _s_t_r_e_a_m (at the
  44.      position at which the file pointer, if defined, is pointing).  The size
  45.      of a word is the size of an integer and varies from machine to machine.
  46.      _p_u_t_w neither assumes nor causes special alignment in the file.
  47.  
  48.      The _p_u_t_c__u_n_l_o_c_k_e_d and _p_u_t_c_h_a_r__u_n_l_o_c_k_e_d functions are equivalent to the
  49.      _p_u_t_c and _p_u_t_c_h_a_r functions, respectively.  However, these functions are
  50.      not thread-safe and thus must only be called under the protection of the
  51.      _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.
  52.  
  53. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  54.      fclose(3S), ferror(3S), fopen(3S), fread(3S), printf(3S), puts(3S),
  55.      setbuf(3S), stdio(3S).
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPUUUUTTTTCCCC((((3333SSSS))))                                                              PPPPUUUUTTTTCCCC((((3333SSSS))))
  71.  
  72.  
  73.  
  74. DIAGNOSTICS
  75.      On success, _p_u_t_c, _p_u_t_c_h_a_r, and _f_p_u_t_c each return the value they have
  76.      written.  On failure, they return the constant EEEEOOOOFFFF.  This will occur if
  77.      the _s_t_r_e_a_m cannot be written for some reason, such as it is not open for
  78.      writing or if the output file cannot be extended.
  79.  
  80.      _P_u_t_w returns the value of _f_e_r_r_o_r(_s_t_r_e_a_m), which is non-zero if an error
  81.      occurred on _s_t_r_e_a_m.
  82.  
  83. CCCCAAAAVVVVEEEEAAAATTTTSSSS
  84.      When using the macro versions of _p_u_t_c and _p_u_t_c_h_a_r, the _s_t_r_e_a_m argument
  85.      may be evaluated more than once.  Thus, it must not be an expression with
  86.      side-effects.  In particular, ppppuuuuttttcccc((((cccc,,,,****ffff++++++++)))) does not work sensibly.  In
  87.      these situations, the macro must either be ####uuuunnnnddddeeeeffff'd, or _f_p_u_t_c should be
  88.      used instead.
  89.  
  90.      Because of possible differences in word length and byte ordering, files
  91.      written using _p_u_t_w are machine-dependent, and may not be read using _g_e_t_w
  92.      on a different processor.
  93.  
  94. BBBBUUUUGGGGSSSS
  95.      When using the macros for _p_u_t_c and _p_u_t_c_h_a_r, hidden external names may be
  96.      referenced. Although these names are prefixed with an underscore, they
  97.      may conflict with names which the ANSI C Standard reserves for the user
  98.      when appearing in a local context.  It is thus recommended that users of
  99.      these macros reserve all names which begin with an underscore for the
  100.      implementation, and avoid defining such names, even in a local context.
  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.