🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: mod.computers.apollo
1 messages
1 total messages Started by kevinUUCP Tue, 17 Feb 1987 12:55
Apollo Pascal Question
#375
Author: kevinUUCP
Date: Tue, 17 Feb 1987 12:55
38 lines
1692 bytes
    Question -- I need to access command line arguments in pascal -
    why can't I do it in one step as this example shows?
    
    program t;
    %include '/sys/ins/base.ins.pas';
    %include '/sys/ins/streams.ins.pas';
    %include '/sys/ins/pgm.ins.pas';
    var argc,i,j : integer;
        argv : pgm_$argv_ptr;
        argvp : pgm_$argv;
        arg : ^pgm_$arg;
    
    begin
       pgm_$get_args(argc,argv);
       argc := argc - 1;
       writeln(argc:1,' arguments found.  They are :');
       for i:=1 to argc do
       begin
    
         { why can't I de-reference the structure in one step 
           as this line does ??
    
         ******* bad line ***** - error = argv not a pointer ******
    
         writeln(argv^[i]^.chars[1]);
    
         }
    
         arg := argv^[i];
         write(i:1,' : ');
         for j := 1 to arg^.len do write(arg^.chars[j]);
         writeln;
       end;
    end.
    
Kevin Buchs   3500 Zycad Dr. Oakdale, MN 55109  (612)779-5548
Zycad Corp.   {rutgers,ihnp4,amdahl,umn-cs}!meccts!zeke!kevin
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads