MR>Hi. I'm working on a file-moving utility, and I want to get the current
>directory (in case of a command like MOVEFILE A:.). I can already get
>the current drive.
>Directory. Problem is, I can never figure out how to set up DS:SI.
MR>I think I have everything else set up all right (DX=0 for instance :).
> Any help showing a slow learner how to set up the string segment would
>be greatly appreciated, however.
Hi Matt, Try this
DEFINT A-Z
FUNCTION GetCurrentDirectory$ (Drive$)
'Drive$ = "c"
'*need to check if there is a disk in the drive before calling
'function on a floppy
Drive$ = UCASE$(LEFT$(Drive$, 1))
Drive% = ASC(Drive$) - 64
DIM directoryString AS STRING * 64
directoryString = directoryString + CHR$(0)
inreg.ax = &H4700
inreg.dx = Drive%
inreg.ds = VARSEG(directoryString)
inreg.si = VARPTR(directoryString)
INTERRUPTX &H21, inreg, outreg
IF (outreg.flags AND &H1) = 0 THEN
GetCurrentDirectory$ = Drive$ + ":\" + directoryString
ELSE
BEEP: GetCurrentDirectory$ = "Error"
END IF
END FUNCTION
Delhi, La., Gateway to: Poverty Point Archaeological Center
Site of the oldest pre-historic civilization in North America
HTTP://cust.iamerica.net./ggodard...........cgodard@iamerica.net
-- SPEED 2.00 #2781: An unbiased opinion is always absolutely valueless.
--- Telegard/QWK v3.02
---------------
* Origin: The Circle Circus * Dale City, VA * 703-730-3115 (1:265/124)
|