Lines Matching refs:is
11 Overview}, a stream is a fairly abstract, high-level concept
47 a stream is called @code{FILE} rather than ``stream''. Since most of
49 the term @dfn{file pointer} is also used to mean ``stream''. This leads
51 manual, however, is careful to use the terms ``file'' and ``stream''
56 The @code{FILE} type is declared in the header file @file{stdio.h}.
60 This is the data type used to represent stream objects. A @code{FILE}
71 deal only with pointers to these objects (that is, @code{FILE *} values)
80 When the @code{main} function of your program is invoked, it already has
90 The @dfn{standard input} stream, which is the normal source of input for the
97 The @dfn{standard output} stream, which is used for normal output from
104 The @dfn{standard error} stream, which is used for error messages and
141 Everything described in this section is declared in the header file
151 The @var{opentype} argument is a string that controls how the file is
160 Open the file for writing only. If the file already exists, it is
161 truncated to zero length. Otherwise a new file is created.
164 Open a file for append access; that is, writing at the end of file only.
166 output to the stream is appended to the end of the file.
167 Otherwise, a new, empty file is created.
171 of the file are unchanged and the initial file position is at the
176 is truncated to zero length. Otherwise, a new file is created.
180 its initial contents are unchanged. Otherwise, a new file is created.
181 The initial file position for reading is at the beginning of the file,
182 but output is always appended to the end of the file.
193 call. Always put the mode (@samp{r}, @samp{w+}, etc.) first; that is
200 The file is opened with cancellation in the I/O functions disabled.
204 @code{exec@dots{}} functions (@pxref{Executing a File}). (This is
209 The file is opened and accessed using @code{mmap}. This is only
216 file. This is equivalent to the @code{O_EXCL} option to the
219 The @samp{x} modifier is part of @w{ISO C11}, which says the file is
233 @code{,ccs=@var{STRING}} then @var{STRING} is taken as the name of a
237 is opened initially unoriented and the orientation is decided with the
238 first file operation. If the first operation is a wide character
239 operation, the stream is not only marked as wide-oriented, also the
242 on even if the locale selected for the @code{LC_CTYPE} category is
251 32 bit machine this function is in fact @code{fopen64} since the LFS
258 included. @xref{Stream/Descriptor Precautions}. This is equally true
267 This function is similar to @code{fopen} but the stream it returns a
268 pointer for is opened using @code{open64}. Therefore this stream can be
271 Please note that the return type is still @code{FILE *}. There is no
275 bits machine this function is available under the name @code{fopen}
281 The value of this macro is an integer constant expression that
284 than this many streams, but that is not guaranteed. The value of this
285 constant is at least eight, which includes the three standard streams
287 value is determined by the @code{OPEN_MAX} parameter; @pxref{General
288 Limits}. In BSD and GNU, it is controlled by the @code{RLIMIT_NOFILE}
295 @c Like most I/O operations, this one is guarded by a recursive lock,
298 @c still bound to the closed descriptor). Also, if the stream is
300 @c signal handler calls freopen again on the same stream, the result is
304 This function is like a combination of @code{fclose} and @code{fopen}.
309 @var{filename} is opened with mode @var{opentype} as for @code{fopen},
312 If the operation fails, a null pointer is returned; otherwise,
320 file is still open, or use @code{open} and then @code{dup2} to install
324 such as @code{stdin} with a file of your own choice. This is useful in
325 programs in which use of a standard stream for certain purposes is
328 this ability, so using @code{freopen} is more portable.
331 32 bit machine this function is in fact @code{freopen64} since the LFS
338 This function is similar to @code{freopen}. The only difference is that
339 on 32 bit machine the stream returned is able to read beyond the
342 using @code{fopen64} or @code{freopen64} since its mode is not important
346 bits machine this function is available under the name @code{freopen}
350 In some situations it is useful to know whether a given stream is
351 available for reading or writing. This information is normally not
361 is nonzero. For write-only streams the function returns zero.
363 This function is declared in @file{stdio_ext.h}.
371 is nonzero. For read-only streams the function returns zero.
373 This function is declared in @file{stdio_ext.h}.
383 @var{stream} was last read from or whether it is opened read-only. In
384 this case the return value is nonzero, otherwise it is zero.
389 This function is declared in @file{stdio_ext.h}.
396 @var{stream} was last written to or whether it is opened write-only. In
397 this case the return value is nonzero, otherwise it is zero.
399 This function is declared in @file{stdio_ext.h}.
407 When a stream is closed with @code{fclose}, the connection between the
408 stream and the file is canceled. After you have closed a stream, you
414 @c After fclose, it is undefined behavior to use the stream it points
415 @c to. Therefore, one must only call fclose when the stream is
418 @c from a signal handler is perfectly safe if the stream is known to be
419 @c no longer used, which is a precondition for fclose to be safe in the
420 @c first place; since this is no further requirement, fclose is safe for
423 @c descriptor may leak if fclose is canceled before @c releasing them.
425 @c is what would enable fclose to be AS- and AC-Safe while freopen
427 @c taken upon cancellation, AC-Safety is lost.
429 the corresponding file to be broken. Any buffered output is written
430 and any buffered input is discarded. The @code{fclose} function returns
434 It is important to check for errors when you call @code{fclose} to close
437 output, it might get an error because the disk is full. Even if you
438 know the buffer is empty, errors can still occur when closing a file if
441 The function @code{fclose} is declared in @file{stdio.h}.
450 @c Like fclose, using any previously-opened streams after fcloseall is
457 is written and any buffered input is discarded. The @code{fcloseall}
464 streams can be identified. It is also problematic since the standard
467 The function @code{fcloseall} is declared in @file{stdio.h}.
486 aware of the possible complications. It is important to know about
499 But there are situations where this is not enough and there are also
500 situations where this is not wanted. The implicit locking is not enough
503 generate is created by several function calls. The functions by
505 atomicity over all the function calls. For this it is necessary to
517 thread will block until the lock is acquired. An explicit call to
527 block if the lock is not available. @code{ftrylockfile} returns zero if
528 the lock was successfully acquired. Otherwise the stream is locked by
540 behavior of a call for a stream which is not locked by the current
541 thread is undefined.
546 (yes, the same job could be done with one @code{fprintf} call but it is
554 fputs ("This is test number ", fp);
567 in the same thread is allowed the locking objects must be equivalent to
569 of times the lock is acquired. The same number of @code{funlockfile}
570 calls by the same threads is necessary to unlock the stream completely.
579 /* @r{This is very wrong!!!} */
584 It is important here that the @code{funlockfile} function is only called
586 is therefore always wrong to ignore the result of @code{ftrylockfile}.
588 The result of code like that above is that either @code{funlockfile}
604 Now that we covered why it is necessary to have locking it is
605 necessary to talk about situations when locking is unwanted and what can
607 free. Even if a lock is not taken the cost is not zero. The operations
610 such systems this is quite costly. So it is best to avoid the locking
611 completely if it is not needed -- because the code in question is never
617 There are two basic mechanisms to avoid locking. The first is to use
622 stream. Using these functions is very desirable since they are
623 potentially much faster. This is not only because the locking
624 operation itself is avoided. More importantly, functions like
627 if the buffer is not empty. With the addition of locking requirements
633 functions even if locking is required. The difference is that the
654 A second way to avoid locking is by using a non-standard function which
655 was introduced in Solaris and is available in @theglibc{} as well.
671 stream @var{stream}. By default this is done but it can be disabled and
682 After the @code{__fsetlocking} function returns, the user is responsible
684 do this anymore until the state is set back to
693 The return value of @code{__fsetlocking} is either
701 This function is especially useful when program code has to be used
702 which is written without knowledge about the @code{_unlocked} functions
712 yet) and then use the normal stream functions. While this is doable it
713 is very cumbersome since performing the conversions is not trivial and
725 This was a beginning but it is still not good enough. Not always is it
727 faster functions cannot handle wide characters. Second, it is not
729 consisting of wide characters. The result is that format strings would
738 same streams (like @code{stdout}). This is different from the model of
746 for normal operations. Once it is decided there is no way back. Only a
753 @code{fread} and @code{fwrite} functions) the stream is marked as not
757 If any of the wide character functions are used the stream is marked as
764 It is important to never mix the use of wide and not wide operations on
772 @c Querying is always safe, but changing the stream when it's in use
779 narrow oriented. It is not possible to overwrite previous orientations
781 oriented before the call nothing is done.
783 If @var{mode} is zero the current orientation state is queried and
784 nothing is changed.
787 value if the stream is narrow, not at all, or wide oriented
790 This function was introduced in @w{Amendment 1} to @w{ISO C90} and is
794 It is generally a good idea to orient a stream as early as possible.
801 a stream unoriented after creation is normally only necessary for
806 contexts it is important to query the orientation of the stream before
824 if the advice above is followed).
826 The encoding used for the @code{wchar_t} values is unspecified and the
828 values this means that it is impossible to write these values directly
829 to the stream. This is not what follows from the @w{ISO C} locale model
830 either. What happens instead is that the bytes read from or written to
833 is determined by the @code{LC_CTYPE} category of the current locale or
836 conversion happens is unspecified and it happens invisibly to the user.
838 Since a stream is created in the unoriented state it has at that point
839 no conversion associated with it. The conversion which will be used is
841 stream is oriented. If the locales are changed at the runtime this
842 might produce surprising results unless one pays attention. This is
861 @c If the stream is in use when interrupted by a signal, the recursive
862 @c lock won't help ensure the stream is consistent; indeed, if fputc
864 @c value is stored, we may overwrite the interrupted write. Conversely,
866 @c may be stored before the character is stored in the buffer,
872 @code{EOF} is returned if a write error occurs; otherwise the
873 character @var{c} is returned.
880 stream @var{stream}. @code{WEOF} is returned if a write error occurs;
881 otherwise the character @var{wc} is returned.
890 The @code{fputc_unlocked} function is equivalent to the @code{fputc}
897 The @code{fputwc_unlocked} function is equivalent to the @code{fputwc}
900 This function is a GNU extension.
906 This is just like @code{fputc}, except that most systems implement it as
907 a macro, making it faster. One consequence is that it may evaluate the
908 @var{stream} argument more than once, which is an exception to the
909 general rule for macros. @code{putc} is usually the best function to
916 This is just like @code{fputwc}, except that it can be implement as
917 a macro, making it faster. One consequence is that it may evaluate the
918 @var{stream} argument more than once, which is an exception to the
919 general rule for macros. @code{putwc} is usually the best function to
926 The @code{putc_unlocked} function is equivalent to the @code{putc}
933 The @code{putwc_unlocked} function is equivalent to the @code{putwc}
936 This function is a GNU extension.
942 The @code{putchar} function is equivalent to @code{putc} with
949 The @code{putwchar} function is equivalent to @code{putwc} with
956 The @code{putchar_unlocked} function is equivalent to the @code{putchar}
963 The @code{putwchar_unlocked} function is equivalent to the @code{putwchar}
966 This function is a GNU extension.
973 @var{stream}. The terminating null character is not written.
996 the stream @var{stream}. The terminating null character is not written.
1007 The @code{fputs_unlocked} function is equivalent to the @code{fputs}
1010 This function is a GNU extension.
1016 The @code{fputws_unlocked} function is equivalent to the @code{fputws}
1019 This function is a GNU extension.
1027 the string is not written. (Note that @code{fputs} does @emph{not}
1030 @code{puts} is the most convenient function for printing simple
1034 puts ("This is a message.");
1038 outputs the text @samp{This is a message.} followed by a newline.
1044 This function writes the word @var{w} (that is, an @code{int}) to
1045 @var{stream}. It is provided for compatibility with SVID, but we
1061 and wide stream functions respectively) that is either a character of
1063 the narrow stream functions it is important to store the result of these
1067 that it is no longer distinguishable from the valid character
1070 you've verified that the result is not @code{EOF}, you can be sure that
1083 @code{EOF} is returned instead.
1091 occurs, @code{WEOF} is returned instead.
1097 The @code{fgetc_unlocked} function is equivalent to the @code{fgetc}
1104 The @code{fgetwc_unlocked} function is equivalent to the @code{fgetwc}
1107 This function is a GNU extension.
1113 This is just like @code{fgetc}, except that it is permissible (and
1115 @var{stream} argument more than once. @code{getc} is often highly
1116 optimized, so it is usually the best function to use to read a single
1123 This is just like @code{fgetwc}, except that it is permissible for it to
1125 than once. @code{getwc} can be highly optimized, so it is usually the
1132 The @code{getc_unlocked} function is equivalent to the @code{getc}
1139 The @code{getwc_unlocked} function is equivalent to the @code{getwc}
1142 This function is a GNU extension.
1148 The @code{getchar} function is equivalent to @code{getc} with @code{stdin}
1155 The @code{getwchar} function is equivalent to @code{getwc} with @code{stdin}
1162 The @code{getchar_unlocked} function is equivalent to the @code{getchar}
1169 The @code{getwchar_unlocked} function is equivalent to the @code{getwchar}
1172 This function is a GNU extension.
1175 Here is an example of a function that does input using @code{fgetc}. It
1211 This function reads a word (that is, an @code{int}) from @var{stream}.
1215 @code{EOF} when it encounters end-of-file or an error, but there is no
1222 Since many programs interpret input on the basis of lines, it is
1250 @code{malloc}. If this buffer is long enough to hold the line,
1260 even if @code{getline} encounters errors and is unable to read any bytes.
1262 In either case, when @code{getline} returns, @code{*@var{lineptr}} is
1265 When @code{getline} is successful, it returns the number of characters
1270 This function is a GNU extension, but it is the recommended way to read
1273 If an error occurs or end of file is reached without any bytes read,
1281 This function is like @code{getline} except that the character which
1282 tells it to stop reading is not necessarily newline. The argument
1286 The text is stored in @var{lineptr}, including the delimiter character
1290 @code{getline} is in fact implemented in terms of @code{getdelim}, just
1309 number of characters read is at most @var{count} @minus{} 1. The extra
1310 character space is used to hold the null character at the end of the
1313 If the system is already at end of file when you call @code{fgets}, then
1314 the contents of the array @var{s} are unchanged and a null pointer is
1315 returned. A null pointer is also returned if a read error occurs.
1316 Otherwise, the return value is the pointer @var{s}.
1332 @var{ws}, but the number of characters read is at most @var{count}
1333 @minus{} 1. The extra character space is used to hold the null wide
1336 If the system is already at end of file when you call @code{fgetws}, then
1337 the contents of the array @var{ws} are unchanged and a null pointer is
1338 returned. A null pointer is also returned if a read error occurs.
1339 Otherwise, the return value is the pointer @var{ws}.
1353 The @code{fgets_unlocked} function is equivalent to the @code{fgets}
1356 This function is a GNU extension.
1362 The @code{fgetws_unlocked} function is equivalent to the @code{fgetws}
1365 This function is a GNU extension.
1373 The newline character is discarded (note that this differs from the
1378 @strong{Warning:} The @code{gets} function is @strong{very dangerous}
1392 In parser programs it is often useful to examine the next character in
1393 the input stream without removing it from the stream. This is called
1410 Here is a pictorial explanation of unreading. Suppose you have a
1455 The function to unread a character is called @code{ungetc}, because it
1465 If @var{c} is @code{EOF}, @code{ungetc} does nothing and just returns
1472 unreading them with @code{ungetc}! But that is a strange way to write a
1473 program; usually @code{ungetc} is used only to unread a character that
1484 buffering for the stream is affected. If a file positioning function
1486 Positioning}) is called, any pending pushed-back characters are
1489 Unreading a character on a stream that is at end of file clears the
1502 Here is an example showing the use of @code{getc} and @code{ungetc} to
1516 /* @r{No need to check for @code{EOF} because it is not}
1537 same format as is used to represent the data in a running program. In
1542 Storing data in binary form is often considerably more efficient than
1559 a read error occurs or the end of the file is reached. This function
1561 or @var{count} is zero.
1571 The @code{fread_unlocked} function is equivalent to the @code{fread}
1574 This function is a GNU extension.
1581 the array @var{data}, to the stream @var{stream}. The return value is
1589 The @code{fwrite_unlocked} function is equivalent to the @code{fwrite}
1592 This function is a GNU extension.
1607 Unless your program is a filter that specifically performs line- or
1609 related functions described in this section is usually the easiest and
1641 output stream as-is, while @dfn{conversion specifications} introduced by
1649 printf ("Processing of `%s' is %d%% finished.\nPlease be patient.\n",
1657 Processing of `foo.txt' is 37% finished.
1674 or @samp{%f} format, depending on what is more appropriate for the
1700 specification are printed as-is to the output stream. Multibyte
1719 is a flag, @samp{10} specifies the field width, the precision is
1720 @samp{8}, the letter @samp{l} is a type modifier, and @samp{d} specifies
1733 situations (such as message translation) this is not desirable and this
1742 The value of @code{NL_ARGMAX} is the maximum value allowed for the
1753 of them in the format string shall have one. Otherwise the behavior is
1764 is padded with spaces to the specified width. This is a @emph{minimum}
1766 field is @emph{not} truncated. Normally, the output is right-justified
1772 printed) is used as the field width. The value must be an @code{int}.
1773 If the value is negative, this means to set the @samp{-} flag (see
1778 written for the numeric conversions. If the precision is specified, it
1784 argument in the argument list (before the actual value to be printed) is
1785 used as the precision. The value must be an @code{int}, and is ignored
1786 if it is negative. If you specify @samp{*} for both the field width and
1791 An optional @dfn{type modifier character}, which is used to specify the
1810 There is also a GNU C syntax to tell the compiler that a function you
1819 Here is a table summarizing what all the different conversions do:
1831 upper-case. @samp{%b} is an ISO C2X feature; @samp{%B} is an
1859 whichever is more appropriate for its magnitude. @samp{%g} uses
1873 This is an alias for @samp{%lc} which is supported for compatibility
1880 This is an alias for @samp{%ls} which is supported for compatibility
1892 (This is a GNU extension.)
1899 If the syntax of a conversion specification is invalid, unpredictable
1905 simply ignored; this is sometimes useful.
1918 specification is just like @samp{%x} except that it uses the characters
1920 conversion specification is just like @samp{%b} except that, with the
1932 plus sign if the value is positive.
1938 includes a sign, this flag is ignored if you supply both of them.
1957 the @code{LC_NUMERIC} category; @pxref{General Numeric}. This flag is a
1962 any indication of sign or base. This flag is ignored if the @samp{-}
1963 flag is also specified, or if a precision is specified.
1966 If a precision is supplied, it specifies the minimum number of digits to
1968 precision, the number is printed with as many digits as it needs. If
1972 Without a type modifier, the corresponding argument is treated as an
1984 Specifies that the argument is a @code{signed char} or @code{unsigned
1985 char}, as appropriate. A @code{char} argument is converted to an
1993 Specifies that the argument is a @code{short int} or @code{unsigned
1994 short int}, as appropriate. A @code{short} argument is converted to an
2000 Specifies that the argument is a @code{intmax_t} or @code{uintmax_t}, as
2006 Specifies that the argument is a @code{long int} or @code{unsigned long
2010 If used with @samp{%c} or @samp{%s} the corresponding parameter is
2017 Specifies that the argument is a @code{long long int}. (This type is
2019 support extra-long integers, this is the same as @code{long int}.)
2021 The @samp{q} modifier is another name for the same thing, which comes
2022 from 4.4 BSD; a @w{@code{long long int}} is sometimes called a ``quad''
2026 Specifies that the argument is a @code{ptrdiff_t}.
2032 Specifies that the argument is a @code{size_t}.
2034 @samp{z} was introduced in @w{ISO C99}. @samp{Z} is a GNU extension
2038 Here is an example. Using the template string:
2056 is too large to fit in the minimum field width specified.
2082 where the number of digits following the decimal point is controlled
2088 Again, the number of digits following the decimal point is controlled by
2090 @samp{%E} conversion is similar but the exponent is marked with the letter
2096 the @samp{%f} style. A precision of @code{0}, is taken as 1.
2098 a decimal-point character appears only if it is followed by a digit.
2105 At the left of the decimal-point character exactly one digit is print.
2106 This character is only @code{0} if the number is denormalized.
2107 Otherwise the value is unspecified; it is implementation dependent how many
2109 the decimal-point character is equal to the precision. If the precision
2110 is zero it is determined to be large enough to provide an exact
2111 representation of the number (or it is large enough to distinguish two
2112 adjacent values if the @code{FLT_RADIX} is not a power of 2,
2118 string. The exponent to the base of two is printed as a decimal number
2122 If the value to be printed represents infinity or a NaN, the output is
2124 specifier is @samp{%a}, @samp{%e}, @samp{%f}, or @samp{%g} and it is
2125 @w{[@code{-}]@code{INF}} or @code{NAN} respectively if the conversion is
2136 Left-justify the result in the field. Normally the result is
2145 a sign, this flag is ignored if you supply both of them.
2156 @pxref{General Numeric}. This flag is a GNU extension.
2160 after any sign. This flag is ignored if the @samp{-} flag is also
2166 these conversions, the default precision is @code{6}. If the precision
2167 is explicitly @code{0}, this suppresses the decimal point character
2171 If the precision is @code{0} or not specified for @samp{%g} or @samp{%G},
2172 it is treated like a value of @code{1}. If the value being printed
2174 value is rounded to the nearest number that fits.
2179 The following type modifier is supported:
2183 An uppercase @samp{L} specifies that the argument is a @code{long
2195 Here is the output:
2217 The @samp{%c} conversion prints a single character. In case there is no
2218 @samp{l} modifier the @code{int} argument is first converted to an
2220 character is converted into the corresponding wide character. The
2232 If there is an @samp{l} modifier present the argument is expected to be
2234 character is converted into a multibyte character before being added to
2237 The @samp{%s} conversion prints a string. If no @samp{l} modifier is
2239 @code{const char *}). If used in a wide stream function the string is
2255 If there is an @samp{l} modifier present, the argument is expected to
2260 is more useful than crashing. But it's not good practice to pass a null
2271 is equivalent to:
2304 The @samp{%n} conversion is unlike any of the other output conversions.
2308 modifiers are permitted to specify that the argument is of type
2327 and sets @code{nchar} to @code{7}, because @samp{3 bears} is seven
2343 the easiest way to make sure you have all the right prototypes is to
2368 This function is just like @code{printf}, except that the output is
2375 This function is just like @code{wprintf}, except that the output is
2382 This is like @code{printf}, except that the output is stored in the character
2383 array @var{s} instead of written to a stream. A null character is written
2389 The behavior of this function is undefined if copying takes place
2390 between objects that overlap---for example, if @var{s} is also given
2397 given in a conversion specification is only a @emph{minimum} value.
2406 This is like @code{wprintf}, except that the output is stored in the
2408 wide character is written to mark the end of the string. The @var{size}
2410 trailing null character is counted towards this limit, so you should
2413 The return value is the number of characters generated for the given
2415 provided buffer a negative value is returned. You should try again with
2416 a bigger output string. @emph{Note:} this is different from how
2430 The @code{snprintf} function is similar to @code{sprintf}, except that
2432 produce. The trailing null character is counted towards this limit, so
2434 If @var{size} is zero, nothing, not even the null byte, shall be written and
2437 The return value is the number of characters which would be generated
2438 for the given input, excluding the trailing null. If this value is
2441 string. Here is an example of doing this:
2446 @r{whose name is @var{name} and whose value is @var{value}.} */
2456 int buflen = snprintf (buffer, size, "value of %s is %s",
2465 how much space is needed.} */
2471 snprintf (buffer, size, "value of %s is %s",
2480 In practice, it is often easier just to use @code{asprintf}, below.
2483 return value is the number of characters stored, not including the
2485 store the result in which case @code{-1} is returned. This was
2498 This function is similar to @code{sprintf}, except that it dynamically
2506 The return value is the number of characters allocated for the buffer, or
2510 Here is how to use @code{asprintf} to get the same result as the
2515 @r{whose name is @var{name} and whose value is @var{value}.} */
2520 if (asprintf (&result, "value of %s is %s", name, value) < 0)
2530 This function is similar to @code{asprintf}, except that it uses the
2547 of my arguments after the first five.'' But there is no way to do this
2549 level there is no way to tell how many arguments your function received.
2551 Since that method is impossible, we provide alternative functions, the
2555 When it is sufficient to define a macro rather than a real function,
2566 But this is limited to macros, and does not apply to real functions at all.
2574 Once your @code{va_list} pointer is pointing at the argument of your
2579 @strong{Portability Note:} The value of the @code{va_list} pointer is
2596 This function is similar to @code{printf} except that, instead of taking
2604 This function is similar to @code{wprintf} except that, instead of taking
2615 @c may leak memory. The unguarded use of __printf_function_table is
2652 This is the equivalent of @code{fprintf} with the variable argument list
2659 This is the equivalent of @code{fwprintf} with the variable argument list
2666 This is the equivalent of @code{sprintf} with the variable argument list
2673 This is the equivalent of @code{swprintf} with the variable argument list
2680 This is the equivalent of @code{snprintf} with the variable argument list
2687 The @code{vasprintf} function is the equivalent of @code{asprintf} with the
2694 @c The obstack is not guarded by mutexes, it might be at an inconsistent
2697 The @code{obstack_vprintf} function is the equivalent of
2702 Here's an example showing how you might use @code{vfprintf}. This is a
2734 In GNU C, there is a special construct you can use to let the compiler
2771 The information is stored in the array @var{argtypes}; each element of
2772 this array describes one argument. This information is encoded using
2776 @var{argtypes}. This is the maximum number of elements that
2780 by @var{template}. If this number is greater than @var{n}, then the
2791 This macro is a bitmask for the type modifier flag bits. You can write
2803 This specifies that the base type is @code{int}.
2807 This specifies that the base type is @code{int}, cast to @code{char}.
2811 This specifies that the base type is @code{char *}, a null-terminated string.
2815 This specifies that the base type is @code{void *}, an arbitrary pointer.
2819 This specifies that the base type is @code{float}.
2823 This specifies that the base type is @code{double}.
2844 If this bit is set, it indicates that the encoded type is a pointer to
2850 If this bit is set, it indicates that the base type is modified with
2855 If this bit is set, it indicates that the base type is modified with
2860 If this bit is set, it indicates that the base type is modified with
2865 This is a synonym for @code{PA_FLAG_LONG_LONG}, used by convention with
2876 Here is an example of decoding argument types for a format string. We
2877 assume this is part of an interpreter which contains arguments of type
2910 @r{and see if the object given is suitable.} */
2955 The way you do this is by registering the conversion with the function
2957 One of the arguments you pass to this function is a pointer to a handler
2973 template when it is called.
2983 @code{printf} template strings is a GNU extension. ISO standard C has
2986 of the language standard it is necessary to disable such handling by
2988 that relies on the extension is undefined.
2993 The function to register a new output conversion is
3000 @c This function is guarded by the global non-recursive libc lock, but
3006 Thus, if @var{spec} is @code{'Y'}, it defines the conversion @samp{%Y}.
3010 characters has no effect. It is advisable not to use lowercase letters,
3014 The @var{handler-function} is the function called by @code{printf} and
3018 existing handler function for @var{spec} is removed.
3020 The @var{arginfo-function} is the function called by
3025 @c The following is not true anymore. The `parse_printf_format' function
3026 @c is now also called from `vfprintf' via `parse_one_spec'.
3039 The return value is @code{0} on success, and @code{-1} on failure
3040 (which occurs if @var{spec} is out of range).
3042 @strong{Portability Note:} It is possible to redefine the standard output
3043 conversions but doing so is strongly discouraged because it may interfere
3062 specifier. This data type is declared in the header file
3068 This structure is used to pass information about the options appearing
3075 This is the precision specified. The value is @code{-1} if no precision
3080 actual value is not known.
3083 This is the minimum field width specified. The value is @code{0} if no
3088 actual value is not known.
3091 This is the conversion specifier character specified. It's stored in
3094 handler function is called.
3097 This is a boolean that is true if the @samp{L}, @samp{ll}, or @samp{q}
3103 This is a boolean that is true if the @samp{hh} type modifier was specified.
3106 This is a boolean that is true if the @samp{h} type modifier was specified.
3109 This is a boolean that is true if the @samp{l} type modifier was specified.
3112 This is a boolean that is true if the @samp{#} flag was specified.
3115 This is a boolean that is true if the @samp{ } flag was specified.
3118 This is a boolean that is true if the @samp{-} flag was specified.
3121 This is a boolean that is true if the @samp{+} flag was specified.
3124 This is a boolean that is true if the @samp{'} flag was specified.
3133 This flag is set if the stream is wide oriented.
3136 This is the character to use for padding the output to the minimum field
3137 width. The value is @code{'0'} if the @samp{0} flag was specified, and
3160 The @var{stream} argument passed to the handler function is the stream to
3163 The @var{info} argument is a pointer to a structure that contains
3171 @c The @code{ap_pointer} argument is used to pass the tail of the variable
3174 @c argument list, this is a @emph{pointer} to a @code{va_list}, rather than
3182 The @var{args} is a vector of pointers to the arguments data.
3192 This is the data type that a handler function should have.
3210 types of each of these arguments. This information is encoded using the
3211 various @samp{PA_} macros. (You will notice that this is the same
3216 This type is used to describe functions that return information about
3223 Here is an example showing how to define a @code{printf} handler function.
3252 @c This is meant to be called by vfprintf, that should hold the lock on
3253 @c the stream, but if this function is called directly, output will be
3258 that there is a postfix character indicating the divisor for the
3260 powers of 1024 or powers of 1000. Which one is used depends on the
3262 character is of lower case, 1024 is used. For upper case characters,
3263 1000 is used.
3266 etc. The full table is:
3305 The default precision is 3, i.e., 1024 is printed with a lower-case
3327 the format character @code{'B'} is an upper-case character. If we
3335 we could also print using a power of 1024. Please note that all that is
3336 different in these two lines is the format specifier. The
3340 The use of @code{'B'} and @code{'b'} is no coincidence. Rather it is
3341 the preferred way to use this functionality since it is available on
3375 the template is very similar to that for @code{printf}, the
3376 interpretation of the template is oriented more towards free-format
3380 file, and there is no concept of precision for the numeric input
3381 conversions as there is for the corresponding output conversions.
3383 match characters in the input stream exactly, but a matching failure is
3387 Another area of difference between @code{scanf} and @code{printf} is
3391 programmers tend to forget this occasionally, so if your program is
3397 read from the stream. The normal return value from @code{scanf} is the
3402 The @code{scanf} function is typically used for things like reading in
3403 the contents of tables. For example, here is a function that uses
3418 formatted output functions. Partly, this is because it takes some care
3419 to use them properly. Another reason is that it is difficult to recover
3432 A @code{scanf} template string is a string that contains ordinary
3446 this is not the case, a matching failure occurs.
3471 (This is a GNU extension.)
3477 this maximum is reached or when a non-matching character is found,
3488 @samp{%d} to specify that the argument is a pointer to a @code{long int}
3504 There is also a GNU C syntax to tell the compiler that a function you
3513 Here is a table that summarizes the various conversion specifications:
3545 determines whether the output is stored as a wide character string or a
3546 multibyte string. If @samp{%s} is used in a wide character function the
3547 string is converted as with multiple calls to @code{wcrtomb} into a
3550 @samp{%ls} is used in a multibyte function the result is converted into
3555 This is an alias for @samp{%ls} which is supported for compatibility
3561 determines whether the output is stored as a wide character string or a
3562 multibyte string. If @samp{%[} is used in a wide character function the
3563 string is converted as with multiple calls to @code{wcrtomb} into a
3566 @samp{%l[} is used in a multibyte function the result is converted into
3572 read is controlled by the maximum field width given for the conversion.
3575 If @samp{%c} is used in a wide stream function the read value is
3579 to @code{MB_CUR_MAX} bytes for each character. If @samp{%lc} is used in
3580 a multibyte function the input is treated as a multibyte sequence (and
3581 not bytes) and the result is converted as with calls to @code{mbrtowc}.
3584 This is an alias for @samp{%lc} which is supported for compatibility
3598 corresponding argument is used. @xref{Other Input Conversions}.
3601 If the syntax of a conversion specification is invalid, the behavior is
3605 types, the behavior is also undefined. On the other hand, extra
3615 radix. The syntax that is recognized is the same as that for the
3621 constant. The syntax that is recognized is the same as that for the
3633 syntax that is recognized is the same as that for the @code{strtoul}
3637 The @samp{%X} conversion is identical to the @samp{%x} conversion. They
3641 @code{%i}, and @code{%n} conversions is @code{int *}, and
3647 Specifies that the argument is a @code{signed char *} or @code{unsigned
3653 Specifies that the argument is a @code{short int *} or @code{unsigned
3657 Specifies that the argument is a @code{intmax_t *} or @code{uintmax_t *}.
3662 Specifies that the argument is a @code{long int *} or @code{unsigned
3663 long int *}. Two @samp{l} characters is like the @samp{L} modifier, below.
3665 If used with @samp{%c} or @samp{%s} the corresponding parameter is
3674 Specifies that the argument is a @code{long long int *} or @code{unsigned long long int *}. (The @…
3676 is the same as @code{long int}.)
3678 The @samp{q} modifier is another name for the same thing, which comes
3679 from 4.4 BSD; a @w{@code{long long int}} is sometimes called a ``quad''
3683 Specifies that the argument is a @code{ptrdiff_t *}.
3688 Specifies that the argument is a @code{size_t *}.
3698 For the floating-point input conversions, the default argument type is
3699 @code{float *}. (This is different from the corresponding output
3700 conversions, where the default type is @code{double}; remember that
3708 Specifies that the argument is of type @code{double *}.
3711 Specifies that the argument is of type @code{long double *}.
3714 For all the above number parsing formats there is an additional optional
3715 flag @samp{'}. When this flag is given the @code{scanf} function
3720 If the @code{"C"} or @code{"POSIX"} locale is selected there is no
3723 Otherwise the longest prefix with a correct form is processed.
3737 Provide a buffer to store it in. This is the default. You should
3739 latter if the @samp{l} modifier is present).
3743 buffer you provide. In general, the only way to do this is to specify a
3750 @samp{a} flag character. This is a GNU extension. You should provide
3755 The @samp{%c} conversion is the simplest: it matches a fixed number of
3757 read; if you don't specify the maximum, the default is 1. This
3761 that many. Since there is always a maximum field width with @samp{%c}
3766 If the format is @samp{%lc} or @samp{%C} the function stores wide
3769 bytes read from the medium is limited by @code{MB_CUR_LEN * @var{n}} but
3789 then the number of characters read is limited only by where the next
3791 input can make your program crash---which is a bug.
3794 except that the external byte sequence is converted using the conversion
3812 An embedded @samp{-} character (that is, one that is not the first or
3813 last character of the set) is used to specify a range of characters.
3817 then the set of allowed input characters is everything @emph{except}
3825 that appear inside regular expressions (such as @samp{[:alpha:]}) is
3839 the standard whitespace characters. This is slightly different from
3848 As for @samp{%c} and @samp{%s} the @samp{%[} format is also modified to
3849 produce wide characters if the @samp{l} modifier is present. All what
3850 is said about @samp{%ls} above is true for @samp{%l[}.
3855 have provided for it. No matter how long your buffer is, a user could
3856 supply input that is longer. A well-written program reports invalid
3873 Here is an example of using the @samp{a} flag with the @samp{%[@dots{}]}
3897 The @samp{%p} conversion is used to read a pointer value. It recognizes
3899 @code{printf} (@pxref{Other Output Conversions}); that is, a hexadecimal
3901 argument should be of type @code{void **}; that is, the address of a
3904 The resulting pointer value is not guaranteed to be valid if it was not
3909 unless a type modifier is in effect (@pxref{Numeric Input Conversions}).
3913 The @samp{%n} conversion is the only mechanism for determining the
3916 is stored for it since @code{scanf} returns before processing the
3941 The return value is normally the number of successful assignments. If
3942 an end-of-file condition is detected before any matches are performed,
3944 template, then @code{EOF} is returned.
3955 The return value is normally the number of successful assignments. If
3956 an end-of-file condition is detected before any matches are performed,
3958 template, then @code{WEOF} is returned.
3964 This function is just like @code{scanf}, except that the input is read
3971 This function is just like @code{wscanf}, except that the input is read
3978 This is like @code{scanf}, except that the characters are taken from the
3980 end of the string is treated as an end-of-file condition.
3982 The behavior of this function is undefined if copying takes place
3983 between objects that overlap---for example, if @var{s} is also given
3991 This is like @code{wscanf}, except that the characters are taken from the
3993 end of the string is treated as an end-of-file condition.
3995 The behavior of this function is undefined if copying takes place
3996 between objects that overlap---for example, if @var{ws} is also given as
4017 This function is similar to @code{scanf}, but instead of taking
4025 This function is similar to @code{wscanf}, but instead of taking
4033 This is the equivalent of @code{fscanf} with the variable argument list
4040 This is the equivalent of @code{fwscanf} with the variable argument list
4047 This is the equivalent of @code{sscanf} with the variable argument list
4054 This is the equivalent of @code{swscanf} with the variable argument list
4058 In GNU C, there is a special construct you can use to let the compiler
4071 Since @code{EOF} is used to report both end of file and random errors,
4080 This macro is an integer value that is returned by a number of narrow
4082 error situation. With @theglibc{}, @code{EOF} is @code{-1}. In
4085 This symbol is declared in @file{stdio.h}.
4090 This macro is an integer value that is returned by a number of wide
4092 error situation. With @theglibc{}, @code{WEOF} is @code{-1}. In
4095 This symbol is declared in @file{wchar.h}.
4102 indicator for the stream @var{stream} is set.
4104 This symbol is declared in @file{stdio.h}.
4112 The @code{feof_unlocked} function is equivalent to the @code{feof}
4115 This function is a GNU extension.
4117 This symbol is declared in @file{stdio.h}.
4124 indicator for the stream @var{stream} is set, indicating that an error
4127 This symbol is declared in @file{stdio.h}.
4133 The @code{ferror_unlocked} function is equivalent to the @code{ferror}
4136 This function is a GNU extension.
4138 This symbol is declared in @file{stdio.h}.
4170 The @code{clearerr_unlocked} function is equivalent to the @code{clearerr}
4173 This function is a GNU extension.
4176 Note that it is @emph{not} correct to just clear the error flag and retry
4187 always fail again in the same way. So usually it is best to give up and
4191 One important exception is @code{EINTR} (@pxref{Interrupted Primitives}).
4197 descriptor is not usually advisable.
4221 The data read from a text stream is divided into @dfn{lines} which are
4222 terminated by newline (@code{'\n'}) characters, while a binary stream is
4236 character in a text stream may disappear when the file is read in again.
4244 Since a binary stream is always more capable and more predictable than a
4246 simply always use binary streams? The answer is that on these operating
4249 with other text-oriented programs is through a text stream.
4251 In @theglibc{}, and on all POSIX systems, there is no difference
4264 stream is currently reading or writing. I/O on the stream advances the
4265 file position through the file. On @gnusystems{}, the file position is
4289 @code{-1} is returned.
4295 The @code{ftello} function is similar to @code{ftell}, except that it
4299 Therefore, using ftell can lead to problems if the implementation is
4301 @code{ftello} is preferable whenever it is available.
4305 the return value is the current file position.
4307 The function is an extension defined in the Unix Single Specification
4311 32 bit system this function is in fact @code{ftello64}. I.e., the
4318 This function is similar to @code{ftello} with the only difference that
4319 the return value is of type @code{off64_t}. This also requires that the
4326 bits machine this function is available under the name @code{ftello}
4333 The @code{fseek} function is used to change the file position of the
4336 indicate whether the @var{offset} is relative to the beginning of the
4352 This function is similar to @code{fseek} but it corrects a problem with
4354 @code{long int} for the offset is not compatible with POSIX.
4358 For this reason it is a good idea to prefer @code{ftello} whenever it is
4359 available since its functionality is (if different at all) closer the
4364 The function is an extension defined in the Unix Single Specification
4368 32 bit system this function is in fact @code{fseeko64}. I.e., the
4375 This function is similar to @code{fseeko} with the only difference that
4376 the @var{offset} parameter is of type @code{off64_t}. This also
4383 bits machine this function is available under the name @code{fseeko}
4398 This is an integer constant which, when used as the @var{whence}
4400 the offset provided is relative to the beginning of the file.
4405 This is an integer constant which, when used as the @var{whence}
4407 the offset provided is relative to the current file position.
4412 This is an integer constant which, when used as the @var{whence}
4414 the offset provided is relative to the end of the file.
4421 beginning of the file. It is equivalent to calling @code{fseek} or
4424 the return value is discarded and the error indicator for the stream is
4449 On @gnusystems{}, the file position is truly a character count. You
4456 is impossible to represent the file position of a text stream as a count
4468 thing you can rely on is that you can use it subsequently as the
4479 The value of the file position indicator of a text stream is undefined
4488 @code{fseeko} functions might help here since the @code{off_t} type is
4494 file positions, it is better to use the functions @code{fgetpos} and
4504 This is the type of an object that can encode information about the
4508 In @theglibc{}, @code{fpos_t} is an opaque data structure that
4514 this type is in fact equivalent to @code{fpos64_t} since the LFS
4520 This is the type of an object that can encode information about the
4524 In @theglibc{}, @code{fpos64_t} is an opaque data structure that
4540 32 bit system the function is in fact @code{fgetpos64}. I.e., the LFS
4547 This function is similar to @code{fgetpos} but the file position is
4552 bits machine this function is available under the name @code{fgetpos}
4568 32 bit system the function is in fact @code{fsetpos64}. I.e., the LFS
4575 This function is similar to @code{fsetpos} but the file position used
4576 for positioning is provided in a variable of type @code{fpos64_t} to
4580 bits machine this function is available under the name @code{fsetpos}
4592 than on a character-by-character basis. This is called @dfn{buffering}.
4611 * Buffering Concepts:: Terminology is defined here.
4629 the file in blocks when a newline character is encountered.
4639 stream connected to an interactive device such as a terminal is
4646 messages ending in a newline will appear immediately---which is usually
4658 buffered output on a stream is flushed automatically:
4662 When you try to do output and the output buffer is full.
4665 When the stream is closed. @xref{Closing Streams}.
4672 When a newline is written, if the stream is line buffered.
4680 @code{fflush}, which is declared in the header file @file{stdio.h}.
4687 to the file. If @var{stream} is a null pointer, then
4698 The @code{fflush_unlocked} function is equivalent to the @code{fflush}
4703 opened. While this is useful in some situations it does often more than
4704 necessary since it might be done in situations when terminal input is
4705 required and the program wants to be sure that all output is visible on
4717 This function is declared in the @file{stdio_ext.h} header.
4727 for a stream but instead simply forget it. If transmission is costly
4728 and the output is not needed anymore this is valid reasoning. In this
4736 @var{stream} to be emptied. If the stream is currently in read mode all
4737 input in the buffer is lost. If the stream is in output mode the
4738 buffered output is not written to the device (or whatever other
4739 underlying storage) and the buffer is cleared.
4741 This function is declared in @file{stdio_ext.h}.
4759 This function is used to specify that the stream @var{stream} should
4773 is not a good idea unless you close the file before exiting the block
4778 the values in the array directly while the stream is using it for
4782 if the value of @var{mode} is not valid or if the request could not
4788 The value of this macro is an integer constant expression that can be
4795 The value of this macro is an integer constant expression that can be
4802 The value of this macro is an integer constant expression that can be
4809 The value of this macro is an integer constant expression that is good
4810 to use for the @var{size} argument to @code{setvbuf}. This value is
4813 The value of @code{BUFSIZ} is chosen on each system so as to make stream
4814 I/O efficient. So it is a good idea to use @code{BUFSIZ} as the size
4818 by means of the @code{fstat} system call: it is found in the
4823 line of input with @code{fgets} (@pxref{Character Input}). There is no
4832 If @var{buf} is a null pointer, the effect of this function is
4834 @code{_IONBF}. Otherwise, it is equivalent to calling @code{setvbuf}
4838 The @code{setbuf} function is provided for compatibility with old code;
4845 If @var{buf} is a null pointer, this function makes @var{stream} unbuffered.
4849 This function is provided for compatibility with old BSD code. Use
4859 This function is provided for compatibility with old BSD code. Use
4863 It is possible to query whether a given stream is line buffered or not
4871 stream @var{stream} is line buffered. Otherwise the return value is
4874 This function is declared in the @file{stdio_ext.h} header.
4878 much of it is used. These functions were also introduced in Solaris.
4887 This function is declared in the @file{stdio_ext.h} header.
4895 For wide-oriented streams the measuring unit is wide characters. This
4898 This function is declared in the @file{stdio_ext.h} header.
4913 objects using functions supplied by your program. This protocol is
4949 @pxref{Unconstrained Allocation}). This is really only useful
4952 buffer (for this, try @code{open_memstream}, below). The buffer is
4953 freed when the stream is closed.
4955 The argument @var{opentype} is the same as in @code{fopen}
4957 append mode, then the initial file position is set to the first null
4958 character in the buffer. Otherwise the initial file position is at the
4961 When a stream open for writing is flushed or closed, a null character
4962 (zero byte) is written at the end of the buffer if it fits. You
4974 Here is an example of using @code{fmemopen} to create a stream for
4995 This function opens a stream for writing to a buffer. The buffer is
4997 After you've closed the stream, this buffer is your responsibility to
5000 When the stream is closed with @code{fclose} or flushed with
5007 A null character is written at the end of the buffer. This null character
5008 is @emph{not} included in the size value stored at @var{sizeloc}.
5016 Here is an example of using @code{open_memstream}:
5043 store data that is read or written.
5052 Inside every custom stream is a special object called the @dfn{cookie}.
5053 This is an object supplied by you which records where to fetch or store
5054 the data read or written. It is up to you to define a data type to use
5056 directly to its contents, and they don't even know what the type is;
5076 This is a structure type that holds the functions that define the
5082 This is the function that reads data from the cookie. If the value is a
5087 This is the function that writes data to the cookie. If the value is a
5088 null pointer instead of a function, then data written to the stream is
5092 This is the function that performs the equivalent of file positioning on
5093 the cookie. If the value is a null pointer instead of a function, calls
5100 closing the stream. If the value is a null pointer instead of a
5101 function, nothing special is done to close the cookie when the stream is
5111 The @var{opentype} argument is interpreted as for @code{fopen};
5113 open'' option is ignored.) The new stream is fully buffered.
5132 This is very similar to the @code{read} function; see @ref{I/O
5144 This is very similar to the @code{write} function; see @ref{I/O
5177 This is the data type that the read function for a custom stream should have.
5178 If you declare the function as shown above, this is the type it will have.
5200 There is another set of functions one can give a stream, the
5208 wait until the rest of the manual is more done and polished.
5248 following values which also is bitwise ORed with the
5253 The source of the condition is some hardware.
5255 The source of the condition is some software.
5257 The source of the condition is some firmware.
5261 can describe the part of the system which detects the problem. This is
5266 The erroneous condition is detected by the application.
5268 The erroneous condition is detected by a utility.
5270 The erroneous condition is detected by the operating system.
5278 It is a recoverable error.
5280 It is a non-recoverable error.
5292 steps to recover from the error and the @var{tag} parameter is a
5298 is to be omitted. The symbolic names for these values are:
5306 Ignore @var{classification} parameter. This implies that nothing is
5316 There is another way certain fields can be omitted from the output to
5317 standard error. This is described below in the description of
5326 Nothing is printed, this value is the same as @code{MM_NULLSEV}.
5328 This value is printed as @code{HALT}.
5330 This value is printed as @code{ERROR}.
5332 This value is printed as @code{WARNING}.
5334 This value is printed as @code{INFO}.
5340 corresponding string to print. This is described below
5344 If no parameter is ignored the output looks like this:
5352 inserted if necessary, i.e., if the corresponding parameter is not
5355 This function is specified in the X/Open Portability Guide. It is also
5361 nothing is printed @code{MM_NOTOK} is returned. Among situations where
5362 all outputs fail this last value is also returned if a parameter value
5363 is incorrect.
5367 @code{fmtmsg}. The first is @code{MSGVERB}. It is used to control the
5379 @code{action}, and @code{tag}. If the environment variable is not given
5380 or is the empty string, a not supported keyword is given or the value is
5381 somehow else invalid, no part of the message is masked out.
5384 @code{fmtmsg} is @code{SEV_LEVEL}. This variable and the change in the
5385 behavior of @code{fmtmsg} is not specified in the X/Open Portability
5386 Guide. It is available in System V systems, though. It can be used to
5405 The @var{severity-keyword} part is not used by @code{fmtmsg} but it has
5406 to be present. The @var{level} part is a string representation of a
5409 this class. It is not possible to overwrite any of the predefined
5410 classes. The @var{printstring} is the string printed when a message of
5411 this class is processed by @code{fmtmsg} (see above, @code{fmtsmg} does
5419 There is another possibility to introduce severity classes besides using
5423 but this is toilsome.
5431 is the string printed in the actual messages instead of the numeric
5434 If @var{string} is @code{NULL} the severity class with the numeric value
5435 according to @var{severity} is removed.
5437 It is not possible to overwrite or remove one of the default severity
5441 The return value is @code{MM_OK} if the task was successfully performed.
5442 If the return value is @code{MM_NOTOK} something went wrong. This could
5443 mean that no more memory is available or a class is not available when
5446 This function is not specified in the X/Open Portability Guide although
5447 the @code{fmtsmg} function is. It is available on System V systems.
5454 Here is a simple example program to illustrate the use of both
5467 value for the @var{action} parameter is @code{"refer to manual"}. One
5484 colons and the @code{TO FIX} string) is printed. But only one of the
5486 print anything because the @var{label} parameter is not in the correct
5489 produced no output since the class with the numeric value @code{6} is
5490 not defined. Although a class with numeric value @code{5} is also not
5522 to @code{fmtmsg} vanished. Please also note that now there is no colon
5523 after the @code{NOTE} and @code{NOTE2} strings in the output. This is
5524 not necessary since there is no more output on this line because the text
5525 is missing.