wdwitte@cs.vu.nl (Witte de W) (05/06/91)
Hi everyone,
my problem consist of that when I want to change drive by using
Exec("c:"), it the first time indeed will change from drive, but the second time
it won't (getting 'bad command or file name'). This problem doesn't occur when
I use a small memory model. I use a TopSpeed compiler.
I hope you can help me (there isn't an other way to change
drive, and 'cause of this error I can't come back on the old drive).
greetings,
wiebe
--
Wiebe de Witte
Uilenstede 114
1183 AN Amstelveen
HOLLANDseurer+@rchland.ibm.com (Bill Seurer) (05/07/91)
You can use Lib.ChDir to change default drives, too. Try
Lib.ChDir("C:");
(I don't have my JPI manuals with me so the capitalization might be a
little different and ChDir might be in File).
- Bill Seurer Programming Support IBM Rochester, MN
Prodigy: CNSX71A Internet: seurer@rchland.vnet.ibm.comwdwitte@cs.vu.nl (Witte de W) (05/09/91)
seurer+@rchland.ibm.com (Bill Seurer) writes: >You can use Lib.ChDir to change default drives, too. Try >Lib.ChDir("C:"); I took FIO.ChDir ('cause Lib indeed hasn't), but I got a Dos Error Code 3 on ChDir("c:"). So, I can't solve the problem this way. -- Wiebe de Witte (E-mail: wdwitte@cs.vu.nl) Uilenstede 114 1183 AN Amstelveen HOLLAND phone: 020 - 6400298
Ben.Coleman@f15.n277.z1.fidonet.org (Ben Coleman) (05/09/91)
Wd> my problem consist of that when I want to change
Wd> drive by using Exec("c:"), it the first time indeed will change
Wd> from drive, but the second time it won't (getting 'bad command or
Wd> file name').
I'm not sure what is going wrong with your situation. Actually, I'm wondering
how it manages to work on the first call - I didn't think the Exec function
would load COMMAND.COM, which is what would be required to process a command
line change drive command.
Anyhow, I wanted to point out that there is a better way to change your current
drive - there is a Dos function to do it. Try the following, which is an
excerpt from Peter Perchansky's public domain PMPLIB. It's written in JPI's
TSM2 1.17, so you may have to make some changes for v 2 or 3:
DEFINITION MODULE PMPDos;
PROCEDURE SetDisk (drive: CHAR): CARDINAL;
(* changes to specified drive, returns last drive number or 0 on error *)
END PMPDos.
IMPLEMENTATION MODULE PMPDos;
(*------------- Procedures from JPI's TopSpeed Modula II -------------*)
FROM AsmLib IMPORT Dos;
FROM SYSTEM IMPORT Registers;
(*--------------------------------------------------------------------*)
VAR
r : Registers;
PROCEDURE SetDisk (drive: CHAR): CARDINAL;
(* changes to specified drive, returns last drive number or 0 on error *)
VAR
ok : BOOLEAN;
BEGIN
ok := FALSE;
WITH r DO
AH := 0EH; (* select disk *)
IF (CAP (drive) >= 'A') AND (CAP (drive) <= 'Z') THEN
DL := SHORTCARD (ORD ( CAP (drive)) - 65);
ok := TRUE
END;
END;
IF ok THEN
Dos (r);
ELSE
r.AL := 0;
END;
RETURN CARDINAL (r.AL); (* last drive number ( 0 on error ) *)
END SetDisk;
END PMPDos.
Ben
--
uucp: uunet!m2xenix!puddle!277!15!Ben.Coleman
Internet: Ben.Coleman@f15.n277.z1.fidonet.org