Definition | #include <stdio.h> int fflush(FILE *fp);
| |
Return val. | 0 |
|
EOF |
| |
Notes | All standard I/O functions that write data to a file (
Exception for ANSI functionality: Internally,
| |
Record I/O | A call to the | |
Example | The following program reads alphabetically sorted names from #include<stdio.h>
int main(void)
{
FILE *fp;
char name[20];
char prevname;
prevname = '%';
fp = fopen ("link=link", "w");
while (gets(name))
{
if(prevname != name[0])
fflush(fp);
else
fputc(' ', fp);
fputs(name, fp);
prevname = name[0];
};
fclose(fp);
return 0;
}
| |
See also | exit, close, fclose | |