Mercurial > hg > early-roguelike
comparison srogue/mdport.c @ 190:f4f6734771e0
srogue: add and use md_fdopen().
The implementation was copied from rogue4.  Using fdopen() is necessary
because the scorefile needs both encread() and encwrite().  For some
reason I have failed to discover, one of them uses FILE *'s and the
other uses file descriptors.
| author | John "Elwin" Edwards | 
|---|---|
| date | Mon, 03 Aug 2015 09:27:43 -0400 | 
| parents | 10c273a62228 | 
| children | fb25a62680c7 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 189:7c552cbc6ad9 | 190:f4f6734771e0 | 
|---|---|
| 353 #ifdef _WIN32 | 353 #ifdef _WIN32 | 
| 354 (void) _chmod(file, 0600); | 354 (void) _chmod(file, 0600); | 
| 355 return( _unlink(file) ); | 355 return( _unlink(file) ); | 
| 356 #else | 356 #else | 
| 357 return(unlink(file)); | 357 return(unlink(file)); | 
| 358 #endif | |
| 359 } | |
| 360 | |
| 361 FILE * | |
| 362 md_fdopen(int fd, char *mode) | |
| 363 { | |
| 364 #ifdef _WIN32 | |
| 365 return( _fdopen(fd, mode) ); | |
| 366 #else | |
| 367 return( fdopen(fd, mode) ); | |
| 358 #endif | 368 #endif | 
| 359 } | 369 } | 
| 360 | 370 | 
| 361 int | 371 int | 
| 362 md_chmod(const char *filename, int mode) | 372 md_chmod(const char *filename, int mode) | 
