Advanced Rogue 5: add and use md_fdopen().

Portability is improved.
This commit is contained in:
John "Elwin" Edwards 2015-08-11 15:15:09 -04:00
parent c0f3e1f004
commit 47df21eb66
3 changed files with 11 additions and 1 deletions

View file

@ -209,6 +209,15 @@ md_creat(char *file, int mode)
return(fd); return(fd);
} }
FILE *
md_fdopen(int fd, char *mode)
{
#ifdef _WIN32
return( _fdopen(fd, mode) );
#else
return( fdopen(fd, mode) );
#endif
}
int int
md_normaluser() md_normaluser()

View file

@ -209,7 +209,7 @@ short monst;
printf("\nCannot open score_file.\n"); printf("\nCannot open score_file.\n");
return; return;
} }
outf = (FILE *) fdopen(fd, "w"); outf = (FILE *) md_fdopen(fd, "w");
/* Get this system's name */ /* Get this system's name */
thissys = md_gethostname(); thissys = md_gethostname();

View file

@ -983,6 +983,7 @@ extern char *md_getpass();
extern char *md_crypt(); extern char *md_crypt();
extern char *md_getroguedir(); extern char *md_getroguedir();
extern void md_init(); extern void md_init();
extern FILE * md_fdopen(int fd, char *mode);
/* /*
* Now all the global variables * Now all the global variables