C++ calling Perl program with parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sirichennupati
    New Member
    • Aug 2007
    • 6

    C++ calling Perl program with parameters

    hi all,

    in our project we have to integrate perl and c++ program
    we could succesfully call the perl program from c++ but
    couldn pass the parameters .........
    which are variables in c++........
    how are the variables passed ...

    system("perl ../perlbanking/new acctno 0 0 tot");

    where in acctno and tot are c++ variables of type int...

    thanks a ton in advance........
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    I would assume that, as in Perl, c++ would resolve the variables to their values prior to actually doing the call to the Perl script. That said and assuming it does so correctly, you would have to have your Perl script coded to handle command line options. Since we do not have access to your code, mostly because you did not post it here, we cannot see wheter it does or not.

    Regards,

    Jeff

    Comment

    • miller
      Recognized Expert Top Contributor
      • Oct 2006
      • 1086

      #3
      Perl provides access to command line parameters via the @ARGV array (perldoc perlvar). However, I do not believe that is directly relevant to your question. It sounds like you're asking how do you interpolate those C++ variables when calling perl via a command line interface. To learn that, you'll have to ask in the C++ Forum.

      - Miller

      Comment

      • sirichennupati
        New Member
        • Aug 2007
        • 6

        #4
        thanks a lot that answers my question i could resolve it converting the parameters using strings i.e. int to char using sprintf

        Comment

        Working...