fflush()

Writes data to a file.

Synopsis

int fflush( file f );

Parameters

Parameter Meaning
f File

Return value

EOF in the event of a write error -1 otherwise, 0.

Error

Description

Writes buffered, not yet written data to the file f and returns EOF in the event of write errors, otherwise 0.

Example

main()
{
  file f;
  f=fopen("C:/TEMP/TEST.TXT","w");
  fputs("Testtext",f);
  fflush(f); // write buffer immediately
  fclose(f);
}

Assignment

File function

Availability

CTRL