stdio.h: fclose

This commit is contained in:
bumbread 2022-07-26 04:07:41 +11:00
parent aa3073904d
commit c96362fb83
1 changed files with 9 additions and 0 deletions

View File

@ -239,6 +239,15 @@ FILE *tmpfile(void) {
}
int fclose(FILE *stream) {
if(fflush(stream) == EOF) {
return EOF;
}
if(stream->buffer.is_internal) {
free(stream->buffer.data);
}
if(!CloseHandle(stream->handle)) {
return EOF;
}
return 0;
}