home *** CD-ROM | disk | FTP | other *** search
- page 58,132
- ;/*
- ;** crnfile.asm
- ;** contains: crnfile()
- ;*/
-
- CREATENEWFILE equ 05bh ;Create New File Function #
- DOSCALL equ 021h ;DOS Software Interrupt
-
- include model.h
- include prologue.h
-
- ifndef AZTEC
- ReferVar _gferror,<cWord>
- endif
-
- dseg dCreateNewFile
- ifdef AZTEC
- ReferVar _gferror,<cWord>
- endif
- endds
-
- pseg ccrnfile
-
- ifdef DSNOTHING
- assume ds:nothing
- endif
-
-
- ;/*
- ;** int
- ;** crnfile(unsigned attribute, char *filename)
- ;**
- ;** ARGUMENT(s)
- ;** attribute -
- ;** filename - Pointer to ASCIIZ filename (path O.K.)
- ;**
- ;** DESCRIPTION
- ;** This function will fail the file open if the filename already exists.
- ;**
- ;**
- ;** RETURNS
- ;** -1 if error other wise returns a file handle. If a -1 is returned
- ;** the error will be stored in the global variable _gferror.
- ;**
- ;** AUTHOR
- ;** "" Fri 11-Nov-1988 14:08:15
- ;** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- ;**
- ;** MODIFICATIONS
- ;**
- ;*/
- cproc crnfile
- mov cx,parm1_
- if _LDATA
- push ds
- lds dx,parm2_ ;DS:DX points to path name
- else
- mov dx,parm2_ ;DS:DX points to path name
- endif
- mov ah,CREATENEWFILE
- int DOSCALL
- jnc createexit ;if no error return file handle
- ifdef DSNOTHING
- mov bx,seg _gferror
- mov ds,bx
- endif
- mov _gferror,ax ;put error in error variable
- mov ax,-1 ;and return -1
- createexit:
- if _LDATA
- pop ds
- endif
- cproce
- endps
- end
-