From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1d846d0e0466c9b X-Google-Attributes: gid103376,public From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) Subject: Re: Program (not task) Activation Date: 1998/04/22 Message-ID: #1/1 X-Deja-AN: 347065160 References: <#CDmPrma9GA.300@ntawwabp.compuserve.com> <6hjtju$kiq$1@owens.ridgecrest.ca.us> Organization: * JerryWare *, Leiden, Holland Newsgroups: comp.lang.ada Date: 1998-04-22T00:00:00+00:00 List-Id: Do-While Jones (do_while@ridgecrest.ca.us) wrote: : Does anyone know why Windows 95 did not return an error code? If you are using GNAT 3.10p on a Win95 machine, GNAT calls the system() function from the MS RTS: int system( const char *command ); If command is NULL and the command interpreter is found, the function returns a nonzero value. If the command interpreter is not found, it returns 0 and sets errno to ENOENT. If command is not NULL, system returns the value that is returned by the command interpreter. It returns the value 0 only if the command interpreter returns the value 0. A return value of - 1 indicates an error, and errno is set to one of the following values: E2BIG Argument list (which is system-dependent) is too big. ENOENT Command interpreter cannot be found. ENOEXEC Command-interpreter file has invalid format and is not executable. ENOMEM Not enough memory is available to execute command; or available memory has been corrupted; or invalid block exists, indicating that process making call was not allocated properly. You must explicitly flush (using fflush or _flushall) or close any stream before calling system. Also, since you are using Ada95, why the difficult code. A portable way to call system() in Ada95 could be: -- demo.adb with Commands; use Commands; procedure Demo is Result : Integer; begin Result := System_Command ("cat demo.adb"); end Demo; -- Commands.ads package Commands is function System_Command (Argument : String) return Integer; end Commands; -- Command.adb with Interfaces.C; use Interfaces.C; package body Commands is function System (S : char_array) return int; pragma Import (C, System, "system"); function System_Command (Argument : String) return Integer is begin return Integer (System (To_C (Argument))); end System_Command; end Commands; -- -- Jerry van Dijk | email: jdijk@acm.org -- Leiden, Holland | member Team-Ada