home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn5ah.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.3 KB  |  27 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;             Function 5AH: Create Temporary File            ;
  4.         ;                                                            ;
  5.         ;             int create_temp(ppathname,attr)                ;
  6.         ;                 char *ppathname;                           ;
  7.         ;                 int attr;                                  ;
  8.         ;                                                            ;
  9.         ;             Returns -1 if file was not created,            ;
  10.         ;             otherwise returns file handle.                 ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   create_temp,PUBLIC,ds
  15. parmDP  ppathname
  16. parmW   attr
  17. cBegin
  18.         loadDP  ds,dx,ppathname ; Get pointer to pathname.
  19.         mov     cx,attr         ; Set function code.
  20.         mov     ah,5ah          ; Ask MS-DOS to make a new file with
  21.                                 ; a unique name.
  22.         int     21h             ; Ask MS-DOS to make a tmp file.
  23.         jnb     ct_ok           ; Branch if MS-DOS returned handle.
  24.         mov     ax,-1           ; Else return -1.
  25. ct_ok:
  26. cEnd
  27.