LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-28-2004, 02:40 AM   #1
Blue_muppet
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Rep: Reputation: 0
calling a c++ binary inside a perl script


Hi all

I have a c++ program that is called 'sim' that takes 6 parameters
invoked at shell by typing './sim <x> <y> <z> <a> <b> <c>'

i would like to call it inside my perl script (very much a n00b here), how do i go about that?

futhermore, i would like to pass parameters to it when the perl script is invoked. Do i do that by just going:
Code:
./$EXE @ARGV[0] @ARGV[1] @ARGV[2] @ARGV[3] @ARGV[4] @ARGV[5];
Obviously with './$EXE' replaced with what u actually use in perl to call a c++ program.

OS is unix.
 
Old 08-28-2004, 08:46 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
If you have not figured out yet, try the system() command, like

system($EXE, $ARGV[0], $ARGV[1],...)
 
Old 08-28-2004, 10:29 PM   #3
Blue_muppet
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
i dont get any error messages, and the script runs through, but it appears that the $EXE i specify does not run.
: /
 
Old 08-28-2004, 11:31 PM   #4
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
see "perldoc -f system" for how to get the error code out of system() if it's not working. If you had been running an executable out of the current directory like "./foo", you'll still need the "./" in the system() call, e.g. system("./$EXE", $arg1, $arg2)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
Issues calling sort from perl using pipe as delimiter amytys Programming 1 10-20-2004 09:35 PM
calling sys_read inside sys_write returns number of bytes read as zero appas Linux - Software 0 08-28-2004 07:21 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
calling subs from within Perl bickford Programming 8 08-13-2000 07:10 PM


All times are GMT -5. The time now is 10:07 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration