home *** CD-ROM | disk | FTP | other *** search
- ;/*
- ;** crunfile.asm
- ;** contains: crunfile()
- ;*/
-
- CREATEUNIQUEFILE equ 05ah ;Create unique file function
- DOSCALL equ 021h ;DOS Software Interrupt
-
- include model.h
- include prologue.h
-
- ReferVar _gferror,<cWord>
-
- pseg ccrunfile
-
- ;/*
- ;** int
- ;** crunfile(unsigned attribute, char *pathname)
- ;**
- ;** ARGUMENT(s)
- ;** attribute -
- ;** pathname - Pointer to ASCIIZ path ending with a
- ;** backslash (\).
- ;**
- ;** DESCRIPTION
- ;** This function generates a uniqe name and attempts to create a new file
- ;** in the specified directory. If the file already exists in the
- ;** directory then another unique name is generated and the process is
- ;** repeated. Programs that need temporary files should use this
- ;** function call to generate unique filenames.
- ;**
- ;**
- ;** RETURNS
- ;** Either a file handle or -1 in which case the error code can be found
- ;** the global variable _gferror
- ;**
- ;** AUTHOR
- ;** "" Fri 11-Nov-1988 14:08:15
- ;** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- ;**
- ;** MODIFICATIONS
- ;**
- ;*/
- cproc crunfile
- 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,CREATEUNIQUEFILE
- int DOSCALL
- jnc createexit
- 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
-