Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!zephyr.ens.tek.com!tektronix!percy!m2xenix!puddle!f15.n277.z1.fidonet.org!Ben.Coleman From: Ben.Coleman@f15.n277.z1.fidonet.org (Ben Coleman) Newsgroups: comp.lang.modula2 Subject: Re: Exec doesn't work with other than small memory model Message-ID: <4451.2829656B@puddle.fidonet.org> Date: 8 May 91 19:10:00 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 1:277/15 - The Back Door QBBS, Morgantown WV Lines: 65 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