Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: system() - output folder?

by pc88mxer (Vicar)
on Jul 18, 2008 at 16:37 UTC ( [id://698667]=note: print w/replies, xml ) Need Help??


in reply to system() - output folder?

You can use shell I/O redirection:
system("program < input-file > output-file");

Replies are listed 'Best First'.
Re^2: system() - output folder?
by lil_v (Sexton) on Jul 18, 2008 at 16:45 UTC
    my code runs like this:
    my $executable = "C:/Desktop/file.exe"; my $output = "C:/Desktop/Folder"; system("$executable", "Argument") == 0 or die "system failed: $?";
    The program 'file.exe' generates output files on its own, I just need to specify the folder so it outputs it there.

      you can chdir to $output before you do your system call.

      if you save your current workdir (Cwd - getcwd) before that chdir, you can chdir back to the previous workdir afterwards, if necessary.

      update: minor text changes, so it is (hopefully) more precise

        thx...it works great!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-16 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found