Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Trying to get an external c program to print to a file

by akrrs7 (Acolyte)
on Nov 04, 2011 at 12:06 UTC ( [id://935904]=note: print w/replies, xml ) Need Help??


in reply to Re: Trying to get an external c program to print to a file
in thread Trying to get an external c program to print to a file

Hello Bart, I did not follow your suggestion. Thanks...
  • Comment on Re^2: Trying to get an external c program to print to a file

Replies are listed 'Best First'.
Re^3: Trying to get an external c program to print to a file
by bart (Canon) on Nov 04, 2011 at 12:18 UTC
    I mean that
    system("$PGMEXEC1", "-arg1=$arg1", "-arg2=$arg2", ">${workingDir}${ps +}$outputFile1");
    will not work, you have to use something like
    system("$PGMEXEC1 -arg1=$arg1 -arg2=$arg2 >${workingDir}${ps}$outputFi +le1");
    See system for the difference between the two.

    If your variable arguments can contain spaces or other characters that are special for the shell, you'll have to escape them. If on Linux or another Unix-derivative, you can use the module String::ShellQuote to handle the hard work. If on Windows, just putting double quotes around the arguments should do, unless you're making life really hard on yourself. (You can wrap the whole command line in qq so you don't have to escape the quotes. Oh, you can't use single quotes there because the variables need to be replaced by their values.)

      But you can write:
      system "'$PGMEXEC1' '-arg1=$arg1' '-arg2=$arg2' > '${workingDir}${ps}$ +outputFile1'";
      Which works fine, unless any of the variables contains a single quote, or ends in a backslash.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://935904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-18 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found