Path: utzoo!attcan!uunet!mcvax!hp4nl!phigate!prle!prles2!prleh3!peter From: peter@prleh3.prl.philips.nl (Peter van Hooft) Newsgroups: comp.sys.hp Subject: Re: system() for pascal Keywords: system, pascal Message-ID: <583@prles2.UUCP> Date: 22 Jul 89 12:39:42 GMT References: <461@oetl1.oetl.UUCP> <4936@ucdavis.ucdavis.edu> Sender: nobody@prles2.UUCP Reply-To: peter@prleh3.prl.philips.nl (Peter van Hooft) Organization: Philips Research Labs Eindhoven Lines: 48 In article <4936@ucdavis.ucdavis.edu> lee@iris.ucdavis.edu (Peng Lee) writes: >Hello all, > > Is there a function like the "system('ls')" in C for the >hpux pascal?? > >Thanks >-Peng Try this: PROGRAM test(INPUT, OUTPUT); TYPE String255 = STRING[55]; VAR Result : INTEGER; FUNCTION System(VAR S: String255): INTEGER; EXTERNAL; { Executes string in a shell } FUNCTION SysRequest(S: String255): INTEGER; VAR I, Len: INTEGER; SystemCommand: String255; BEGIN SystemCommand:= S; { convert pascal to C string } Len:= STRLEN(S); $ range off $ FOR I:= 1 TO Len DO SystemCommand[I - 1]:= SystemCommand[I]; SystemCommand[Len]:= #0; $ range on $ { do the system() } SysRequest:= System(SystemCommand); END; BEGIN { main } Result:= SysRequest('ls'); WRITELN('The result was ', Result:1); END. { main } Hope this helps peter