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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Example of Spawn call Reply-To: anon@anon.org (anon) References: <50d832b4-140d-4029-8d7c-9397115160ba@u8g2000yqn.googlegroups.com> <7cc6117d-689f-41ef-be05-882a7b5453a7@y34g2000prb.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Sat, 02 May 2009 18:28:35 GMT NNTP-Posting-Host: 12.64.48.144 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1241288915 12.64.48.144 (Sat, 02 May 2009 18:28:35 GMT) NNTP-Posting-Date: Sat, 02 May 2009 18:28:35 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:5656 Date: 2009-05-02T18:28:35+00:00 List-Id: I am not the guy that ask for help. My example worked for the simple version of spawn. I think the first guy "Daniel" who ask for help forgot to use the "Argument_String_To_List" routine to build the agument list. Even if there is no arguments he should call "Argument_String_To_List" and give it a null string ( "" ) to insure that the parameter is correct for the "spawn" call. In <7cc6117d-689f-41ef-be05-882a7b5453a7@y34g2000prb.googlegroups.com>, Hang writes: >On 5=D4=C21=C8=D5, =CF=C2=CE=E711=CA=B128=B7=D6, a...@anon.org (anon) wrote= >: >> with Ada.Text_IO ; >> use Ada.Text_IO ; >> >> with GNAT.OS_Lib ; -- Could be System.OS_Lib >> use GNAT.OS_Lib ; >> >> procedure test is >> >> Program_Name : String :=3D "temp.exe" ; >> Args : Argument_List_Access ; >> Success : Boolean ; >> >> begin -- test >> >> -- Create argument list. >> >> Args :=3D Argument_String_To_List ( " First -second 3" ) ; >> >> Spawn ( Program_Name, Args.all, Success ) ; >> if Success then >> Put_Line ( "Temp was Spawned Correctly" ) ; >> else >> Put_Line ( "ERROR: Spawn" ) ; >> end if ; >> end test ; >> >> -- >> -- Spawned program. May require open/close calls for checking output >> -- >> with Ada.Command_Line ; >> use Ada.Command_Line ; >> with Ada.Text_IO ; >> use Ada.Text_IO ; >> >> procedure temp is >> >> begin >> for Index in 1 .. Argument_Count loop >> Put ( Index'img ) ; >> Put ( " =3D> " ) ; >> Put_Line ( Argument ( Index ) ) ; >> end loop ; >> end temp ; >> >> In <50d832b4-140d-4029-8d7c-939711516...@u8g2000yqn.googlegroups.com>, da= >niel.wenge...@home.se writes: >> >> >Though not an Ada issue, really, someone here might have had the same >> >problem as I have had: I tried to make a small program start another >> >program using System.OS_Lib.Spawn. However, it raised Program_Error >> >and stated Exception_Access_Violation. >> >> >Any ideas why, and what to do about it? >> >> >/D >> >> > >I'm not seeing any problem: > >C:\GNAT\Projects\test>test > 1 =3D> First > 2 =3D> -second > 3 =3D> 3 >Temp was Spawned Correctly >