home *** CD-ROM | disk | FTP | other *** search
- include compiler.inc
- ttl CREAT, 1.03, 08/03/86, clr
- ;
- ;
- ; NAME: creat - create a new file
- ;
- ; Synopsis: int creat(fname)
- ; char *fname; ; file name to create
- ;
- ; Description: creat() creates a file and opens it for write-only access.
- ; If the file already exists, it is truncated so that nothing
- ; is in it. creat() returns as its value a file handle, which
- ; is used by other standard i/o functions. This handle is
- ; unique for each file opened or created. If creat() fails,
- ; it returns a -1, and sets the global error value.
- ;
- ;
- ;
- dseg
- exterr
- cseg
-
- procdef creat,<<fname,ptr>>
-
- ldptr dx,fname,ds ;name pointer
- xor ax,ax
- moverr ax
- xor cx,cx ;no attributes
- mov ax,3C00h ;on new file
- int 21h
- jnb ex2 ;created OK
-
- err:
- moverr ax ;error
- mov ax,-1
-
- ex2:
- pret
- pend creat
-
- finish