
WRITEF(2)                  silmul_efun                  WRITEF(2)

名称
     writef - 以格式化方式送讯息给玩家.

语法
     string writef( string str, int n, int flags );

描述
     Given a string str, creates a string of length n, padded  or
     truncated  as  needed, following the directives given by the
     flags  argument.   The  following  flags  are   defined   in
     <writef.h>:

     JFY_RIGHT     right justified  output  TRUNCATE       ok  to
     truncate  str  if longer than n chars TRUNC_RIGHT   truncate
     by removing chars from end of str TRUNC_ELL     use ellipsis
     ("...") to show truncation QUIET         don't write format-
     ted string to this_player

     The above flags may be combined using the boolean OR  opera-
     tor ("|").  For example:

     writef(str, n, JFY_RIGHT | TRUNCATE | TRUNC_ELL);
          /* specifies output is to be truncated, right
             justified, with an ellipsis to show where
             characters were deleted.  Output string
             will be echoed to this_player before
             writef returns the formatted string to
             the calling function. */

     writef(str, n, TRUNCATE | TRUNC_ELL | QUIET);
          /* specifies output is left justified,
             truncated as needed, with characters
             deleted from the beginning of the
             string (since TRUNC_RIGHT was not
             specified), and an ellipsis at the
             beginning of truncated string to
             show that truncation has occurred.
             The output string will NOT be echoed
             to this_player. */

     Also defined in <writef.h> are the following constants:

     PAD a string of 61 spaces, used to pad the output string
         when str is less than n chars long.  ERR a string of  61
     asterisks ("*"), used to show string
         overflow if str is more than n chars long and the
         TRUNCATE flag was not set in the flags argument.

     注意:  Because these constants are only 61 characters long,
            you should make sure n is never greater than 61, or


MudOS Release 0.9         Last change:                   3-19-93

WRITEF(2)                  silmul_efun                  WRITEF(2)

            the formatting in your  output  string  may  be  dis-
     torted.

其它参考档案
     write(), /include/writef.h

作者
     Ichabod@TMI,  3/26/93  (documentation)  Jubal@TMI,  10/25/91
     wade@future 4/8/1996 翻译

Sun Release 4.1           Last change:                          2

