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
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SMC21LIB.LZH
/
FOPEN.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
768b
|
29 lines
#define NOCCARGC
#include stdio.h
#include clib.def
/*
** Open file indicated by fn.
** Entry: fn = Null-terminated CP/M file name.
** May be prefixed with letter of drive.
** mode = "a" -append
** "r" -read
** "w" -write
** "a+" -append update
** "r+" -read update
** "w+" -write update
** Returns a file descriptor on success, else NULL.
*/
fopen(fn, mode) char *fn, *mode; {
int fd;
fd = 0; /*skip stdin (= error return) */
while(++fd < MAXFILES) {
if(_mode(fd) == NULL) {
if(_open(fn, mode, fd)!=ERR) return (fd);
break;
}
}
return (NULL);
}