Sorry, I misread the question.

The only way I can think of to do it is:


    int i;
    int a[] = {"one", "two", "three", "four", "five");
    char command[64] = "perl script.pl ";

    for (i = 0; i < sizeof a / sizeof a[0]; ++i)
    {
        strcat (command, a[i]);
    }

    system (command);

    exit (0);


But there may well be a better way.

Cheers,

Rob



> -----Original Message-----
> From: Sutapalli, eswara [mailto:[EMAIL PROTECTED]]
> Sent: 06 September 2001 13:23
> To: 'Rob Dixon '
> Subject: RE: Reg passing arguements
> 
> 
>  Hi,
>   thanx for ur prompt reply.
>   
>   But I need to call a perl script from C prog and having that array
>   in C style. Can I pass that array straightly to perl script.
>   How can I do that, can u pl put a light on it.
> 
> thanx,
> eswar
> 
> -----Original Message-----
> From: Rob Dixon
> To: Sutapalli, eswara; 'nafiseh saberi '; [EMAIL PROTECTED]
> Sent: 09/06/2001 2:28 PM
> Subject: RE: Reg passing arguements
> 
> That's really easy as long as the array is the /only/ thing you want to
> pass.
> 
>     my @array = qw(one two three four five);
> 
>     printarray (@array);
> 
>     sub printarray
>     {
>         print "@_";    # parameter list passed as built-in array @_
>     }
> 
> If, however, you need to pass the array together with other parameters
> and be
> able to process them separately within the subroutine then you need to
> pass
> array references. Let us know if you need anything more before we take
> this
> leap.
> 
> Cheers,
> 
> Rob
> 
> 
> > -----Original Message-----
> > From: Sutapalli, eswara [mailto:[EMAIL PROTECTED]]
> > Sent: 06 September 2001 07:26
> > To: 'nafiseh saberi '; '[EMAIL PROTECTED] '
> > Subject: Reg passing arguements
> >
> >
> > Hi,
> >
> >   please let me know how to pass an array from a C program
> >   to perl script as an arguement.
> >
> >   Eg:  I've an array with five elements, I need to call
> >        a perl script to print these values.
> >
> > thanx in advance,
> > eswar
> >
> > WARNING: The information in this message is confidential and may be
> legally
> > privileged. It is intended solely for the addressee.  Access to this
> message
> > by anyone else is unauthorised.  If you are not the intended
> recipient, any
> > disclosure, copying, or distribution of the message, or any action or
> > omission taken by you in reliance on it, is prohibited and may be
> unlawful.
> > Please immediately contact the sender if you have received this
> message in
> > error. Thank you.----------------- HCL Perot Systems
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> WARNING: The information in this message is confidential and may be legally
> privileged. It is intended solely for the addressee.  Access to this message
> by anyone else is unauthorised.  If you are not the intended recipient, any
> disclosure, copying, or distribution of the message, or any action or
> omission taken by you in reliance on it, is prohibited and may be unlawful.
> Please immediately contact the sender if you have received this message in
> error. Thank you.----------------- HCL Perot Systems
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to