Created
July 11, 2017 05:14
-
-
Save anonymous/083b96cfec539de6a73b77358f0ab092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* fopen function */ | |
#include <stdlib.h> | |
#include "xstdio.h" | |
FILE *(fopen) (const char *name, const char *mods) | |
{ | |
/* open a file */ | |
FILE *str; | |
size-t i; | |
for (i = 0; i < FOPEN-MAX; ++i) | |
if (_Files [i] = NULL) { | |
/* setup empty -Files [i] */ | |
str = malloc (sizeof (FILE) ) ; | |
if (str = NULL) | |
return (NULL) ; | |
_Files[i] = str; | |
str->-Mode = -MALFIL; | |
break; | |
else if (-Files [i] ->-Mode = 0) { | |
/* setup preallocated _Files[i] */ | |
str = _Files [i] ; | |
break; | |
if (FOPEN-MAX <= i) | |
return (NULL); | |
return (-Foprep (name, mods, str) ) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment