X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffclose.c;h=446b8ee471efe56edea8f05b8a1c2289dd2d1f39;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=04a9aa26844a09bf941210a08ac8281d49eb95be;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/stdio/fclose.c b/functions/stdio/fclose.c index 04a9aa2..446b8ee 100644 --- a/functions/stdio/fclose.c +++ b/functions/stdio/fclose.c @@ -6,3 +6,38 @@ // ---------------------------------------------------------------------------- int fclose( FILE * stream ) { /* TODO */ }; + +/* PDPC code - unreviewed. +Read the note in fopen.c. +int fclose(FILE *stream) +{ +#ifdef __OS2__ + APIRET rc; +#endif + + fflush(stream); +#ifdef __OS2__ + rc = DosClose(stream->hfile); +#endif +#ifdef __MSDOS__ + __close(stream->hfile); +#endif +#ifdef __MVS__ + __aclose(stream->hfile); +#endif + __userFiles[stream->intFno] = NULL; + if (!stream->theirBuffer) + { + free(stream->intBuffer); + } + free(stream); +#ifdef __OS2__ + if (rc != 0) + { + errno = rc; + return (EOF); + } +#endif + return (0); +} +*/