home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
SMALLC21
/
SMC21LIB.LBR
/
FREOPEN.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
768b
|
23 lines
#define NOCCARGC
#include stdio.h
/*
** Close previously opened fd and reopen it.
** Entry: fn = Null-terminated CP/M file name.
** May be prefixed with letter of drive.
** May be just CON:, RDR:, PUN:, or LST:
** mode = "a" -append
** "r" -read
** "w" -write
** "a+" -append update
** "r+" -read update
** "w+" -write update
** Returns the original fd on success, else NULL.
*/
freopen(fn, mode, fd) char *fn, *mode; int fd; {
if(fclose(fd)) return (NULL);
if(_open(fn, mode, fd)==ERR) return (NULL);
return (fd);
}