| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Deleting Files? |
In a message dated 30 Mar 96, Daniel O'Shea of 3:634/396.1 wrote:
DO> Just wondering, is there any way to Delete a File from within a Pascal
DO> Program?
I assume you mean TP/BP - the following works okay under DOS and Windows,
and stores any errors in a global called ESBDosError.
procedure FDel (FName : PathStr); assembler;
asm
mov bx, ds { Save DS }
lds si, [FName] { DS:SI => FileName }
{ Convert to AsciiZ String }
sub ah, ah
lodsb { Load Length into AX }
mov dx, si { Leave DS:DX => AsciiZ FileName }
add si, ax { Move To End of String }
mov byte ptr [si], 0 { store 0 at end of string }
mov ah, $41 { 41h - DOS Delete File Function }
{$IFDEF WINDOWS}
call Dos3Call
{$ELSE}
int $21
{$ENDIF}
JC {at}1 { If Carry Set then Error Occurred }
sub ax, ax { Clear AX }
{at}1: mov ds, bx { Restore DS }
mov [ESBDosError], ax { store Error }
end;
DO> Another thing, is there a way to test that a line read from a file is a
DO> blank line? I've tried:
DO> If Line = ' ' then...
DO> If Line = '' then...
DO> and even
DO> If Line = Chr(13) + Chr(10) then...
DO> But none of these seem to work! Help! :^>}}
If you've read a line into a String variable then you need to "Strip" the
spaces then check the length. Let me know if you need a "Strip
Spaces" Routine.
BTW - SWAG is a good library of doing things such as you've asked...
-Glenn Crouch
Sysop, Algorithms Anonymous (090) 93-3145 (Australia)
3:690/643.3
esbglenn{at}acslink.net.au
---
* Origin: Glenn's Point - Kalgoorlie, West Australia (3:690/643.3)SEEN-BY: 633/267 270 @PATH: 6430/3 690/643 613 660 711/409 808 50/99 635/544 727 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.