Jump to content

DosDelete (FAPI): Difference between revisions

From EDM2
Created page with "==Description== This call removes a directory entry associated with a file name. ==Syntax== <PRE> DosDelete (FileName, Reserved) </PRE> ==Parameters== ; FileName (PSZ)..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This call removes a directory entry associated with a file name.
This call removes a directory entry associated with a file name.


==Syntax==
==Syntax==
<PRE>
  DosDelete (FileName, Reserved)
  DosDelete


    (FileName, Reserved)
</PRE>
==Parameters==
==Parameters==
; FileName (PSZ) - input : Address of the name of the file to be deleted.
;FileName ([[PSZ]]) - input: Address of the name of the file to be deleted.
 
:DosQSysInfo is called by an application during initialization to determine the maximum path length allowed by OS/2.
DosQSysInfo is called by an application during initialization to determine the maximum path length allowed by OS/2.  
;Reserved (ULONG) - input : Reserved and must be set to zero.
 
; Reserved (ULONG) - input : Reserved and must be set to zero.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
* 2 ERROR_FILE_NOT_FOUND
 
* 3 ERROR_PATH_NOT_FOUND
* 0         NO_ERROR  
* 5 ERROR_ACCESS_DENIED
* 2         ERROR_FILE_NOT_FOUND  
* 26 ERROR_NOT_DOS_DISK
* 3         ERROR_PATH_NOT_FOUND  
* 32 ERROR_SHARING_VIOLATION
* 5         ERROR_ACCESS_DENIED  
* 36 ERROR_SHARING_BUFFER_EXCEEDED
* 26       ERROR_NOT_DOS_DISK  
* 87 ERROR_INVALID_PARAMETER
* 32       ERROR_SHARING_VIOLATION  
*206 ERROR_FILENAME_EXCED_RANGE
* 36       ERROR_SHARING_BUFFER_EXCEEDED  
* 87       ERROR_INVALID_PARAMETER  
* 206       ERROR_FILENAME_EXCED_RANGE


==Remarks==
==Remarks==
Global file name characters are not permitted.
Global file name characters are not permitted.


A file whose read-only attribute is set cannot be deleted. To change the setting of the read-only bit, call DosSetFileMode.  
A file whose read-only attribute is set cannot be deleted. To change the setting of the read-only bit, call DosSetFileMode.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSFILEMGR
#define INCL_DOSFILEMGR
Line 42: Line 33:
USHORT  rc = DosDelete(FileName, Reserved);
USHORT  rc = DosDelete(FileName, Reserved);


PSZ             FileName;      /* File name path */
PSZ     FileName;      /* File name path */
ULONG           0;            /* Reserved (must be zero) */
ULONG   0;            /* Reserved (must be zero) */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>
This example deletes a file in the current directory named test.dat.


===MASM===
<PRE>
EXTRN  DosDelete:FAR
INCL_DOSFILEMGR    EQU 1
PUSH@  ASCIIZ  FileName      ;Filename path name string
PUSH  DWORD  0            ;Reserved (must be zero)
CALL  DosDelete
Returns WORD
</PRE>
==Example==
This example deletes a file in the current directory named test.dat.
<PRE>
<PRE>
#define INCL_DOSFILEMGR
#define INCL_DOSFILEMGR
Line 60: Line 64:
                   RESERVED);      /* Reserved (must be zero) */
                   RESERVED);      /* Reserved (must be zero) */
</PRE>
</PRE>
===MASM Binding===
<PRE>
EXTRN  DosDelete:FAR
INCL_DOSFILEMGR    EQU 1
PUSH@  ASCIIZ  FileName      ;Filename path name string
PUSH  DWORD  0            ;Reserved (must be zero)
CALL  DosDelete
Returns WORD
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 13:02, 29 February 2020

This call removes a directory entry associated with a file name.

Syntax

DosDelete (FileName, Reserved)

Parameters

FileName (PSZ) - input
Address of the name of the file to be deleted.
DosQSysInfo is called by an application during initialization to determine the maximum path length allowed by OS/2.
Reserved (ULONG) - input
Reserved and must be set to zero.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 2 ERROR_FILE_NOT_FOUND
  • 3 ERROR_PATH_NOT_FOUND
  • 5 ERROR_ACCESS_DENIED
  • 26 ERROR_NOT_DOS_DISK
  • 32 ERROR_SHARING_VIOLATION
  • 36 ERROR_SHARING_BUFFER_EXCEEDED
  • 87 ERROR_INVALID_PARAMETER
  • 206 ERROR_FILENAME_EXCED_RANGE

Remarks

Global file name characters are not permitted.

A file whose read-only attribute is set cannot be deleted. To change the setting of the read-only bit, call DosSetFileMode.

Bindings

C

#define INCL_DOSFILEMGR

USHORT  rc = DosDelete(FileName, Reserved);

PSZ     FileName;      /* File name path */
ULONG   0;             /* Reserved (must be zero) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosDelete:FAR
INCL_DOSFILEMGR     EQU 1

PUSH@  ASCIIZ  FileName      ;Filename path name string
PUSH   DWORD   0             ;Reserved (must be zero)
CALL   DosDelete

Returns WORD

Example

This example deletes a file in the current directory named test.dat.

#define INCL_DOSFILEMGR

#define FILE_DELETE "test.dat"
#define RESERVED 0L

USHORT rc;

   rc = DosDelete(FILE_DELETE,    /* File path name */
                  RESERVED);      /* Reserved (must be zero) */