Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      ungetwc

      From cppreference.com
      <c‎ |io
       
       
      File input/output
      Types and objects
      Functions
      File access
      Unformatted input/output
      (C95)(C95)
      (C95)
      (C95)(C95)
      (C95)
      ungetwc
      (C95)

      Formatted input
       
      Defined in header<wchar.h>
      wint_t ungetwc( wint_t ch,FILE*stream);
      (since C95)

      Ifch does not equalWEOF, pushes the wide characterch into the input buffer associated with the streamstream in such a manner that subsequent read operation fromstream will retrieve that wide character. The external device associated with the stream is not modified.

      Stream repositioning operationsfseek,fsetpos, andrewind discard the effects ofungetwc.

      Ifungetwc is called more than once without an intervening read or repositioning, it may fail (in other words, a pushback buffer of size 1 is guaranteed, but any larger buffer is implementation-defined). If multiple successfulungetwc were performed, read operations retrieve the pushed-back wide characters in reverse order ofungetwc

      Ifch equalsWEOF, the operation fails and the stream is not affected.

      A successful call toungetwc clears the end of file status flagfeof.

      A successful call toungetwc on a stream (whether text or binary) modifies the stream position indicator in unspecified manner but guarantees that after all pushed-back wide characters are retrieved with a read operation, the stream position indicator is equal to its value beforeungetwc.

      Contents

      [edit]Parameters

      ch - wide character to be put back
      stream - file stream to put the wide character back to

      [edit]Return value

      On successch is returned.

      On failureWEOF is returned and the given stream remains unchanged.

      [edit]References

      • C11 standard (ISO/IEC 9899:2011):
      • 7.29.3.10 The ungetwc function (p: 425-426)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.24.3.10 The ungetwc function (p: 370-371)

      [edit]See also

      puts a character back into a file stream
      (function)[edit]
      gets a wide character from a file stream
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/io/ungetwc&oldid=86961"

      [8]ページ先頭

      ©2009-2025 Movatter.jp