Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      fflush

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

      Formatted input
       
      Defined in header<stdio.h>
      int fflush(FILE* stream);

      For output streams (and for update streams on which the last operation was output), writes any unwritten data from thestream's buffer to the associated output device.

      For input streams (and for update streams on which the last operation was input), the behavior is undefined.

      Ifstream is a null pointer, all open output streams are flushed, including the ones manipulated within library packages or otherwise not directly accessible to the program.

      Contents

      [edit]Parameters

      stream - the file stream to write out

      [edit]Return value

      Returns zero on success. OtherwiseEOF is returned and the error indicator of the file stream is set.

      [edit]Notes

      POSIXextends the specification of fflush by defining its effects on an input stream, as long as that stream represents a file or another seekable device: in that case the POSIX file pointer is repositioned to match the C stream pointer (which effectively undoes any read buffering) and the effects of anyungetc orungetwc that weren't yet read back from the stream are discarded.

      Microsoft also extends the specification of fflush by defining its effects on an input stream: in Visual Studio 2013 and prior, itdiscarded the input buffer, in Visual Studio 2015 and newer, ithas no effect, buffers are retained.

      [edit]References

      • C23 standard (ISO/IEC 9899:2024):
      • 7.21.5.2 The fflush function (p: TBD)
      • C17 standard (ISO/IEC 9899:2018):
      • 7.21.5.2 The fflush function (p: TBD)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.21.5.2 The fflush function (p: 305)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.19.5.2 The fflush function (p: 270-271)
      • C89/C90 standard (ISO/IEC 9899:1990):
      • 4.9.5.2 The fflush function

      [edit]See also

      opens a file
      (function)[edit]
      closes a file
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/io/fflush&oldid=179126"

      [8]ページ先頭

      ©2009-2025 Movatter.jp