Delete File with INT 21h F41h ( Dos services )by (no login)
Hello, my English is low, I from Spain. Thanks !
Hello people, I have other question. I want delete one file ussing Int 21 ( Dos services) function 41h ( Delete one file ). Here is the definition :
For use this you must call to quick basic library : c:\qbx /l qbx.qlb
Function 41h - Delete fileAction:
Deletes a file from the specified or default disc and directory.
AH = 41h
DS.DX = Segment:offset of ASCIIZ file specification
Carry clear if successful, set if failed, when AX = Error code as follows:
2: File not found
5: Access denied
This deletes a file by deleting its directory entry. The ASCIIZ string specifying the file may not include wildcards. The function fails if:
Any part of the path does not exist.
The specified file has a read-only attribute.
And this is my code.
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
bp AS INTEGER
si AS INTEGER
di AS INTEGER
flags AS INTEGER
ds AS INTEGER
es AS INTEGER
DIM INREGS AS regtypeX
DIM OUTREGS AS regtypeX
a$ = "c:\brr.txt" 'I want delete this file
Print SSEG(a$) 'This is the segment's a$ in the memory.
segment% = SSEG(a$)
Print SADD(a$) 'This is the offset's a$ in the memory.
offset% = SADD(a$)
def seg = segment% 'I go to segment's a$
for i% = 0 to len(a$) - 1 ' I read a$ from memory , to check is good
a% = peek(i% + offset%)
locate 3,1 + i% : print chr$(a%)
Inregs.AX = &h4100 '
inregs.DS = segment%
inregs.DX = offset%
I don't understean because is not delete the file. What is wrong??? Thanks people !!!
|Response Title||Author and Date|
|Use KILL instead. No reason to use Interrupt for that!||on Mar 31|
|Hello Clippy||on Mar 31|
|Deleting a file which is currently open may lead to filesystem corruption.||on Mar 31|
|asciiz means null terminated||on Apr 2|
|I don't think that NTVDM will let you delete a file in XP or newer||on Apr 3|
|If your in 64||Unseen Machine on Apr 3|
|Well, KILL works, doesn't it?||on Apr 3|
|The Absolute code worked. Never seen SEG used like that???||on Apr 3|
|*SEG forces the parameter to be passed as a far pointer, instead of as a near pointer.||on Apr 3|
|* I'd like to use your demo in the QB64 WIKI if that is OK with you Michael.||on Apr 7|
|Yes||on Apr 7|
|I just wanted to document it in case it ever does||on Apr 7|
|SEG||DICK on Apr 7|
|turbo basic||DICK on Apr 7|
|Thanks for the explanation!||on Apr 7|
|*I forgot about LDS... (I've read about it, but I don't think I've used it yet.)||on Apr 8|
|*I have 4 posts here(URL)||on Apr 8|
|Gabriel emailed me.||on Apr 3|