LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 03-17-2004, 04:34 AM   #1
akaash
LQ Newbie
 
Registered: Mar 2004
Location: Gujarat, India
Posts: 22

Rep: Reputation: 15
how to call c programm from perl scripts


hello friends,

i askd all of u that

how can c program is called from perl scripts?????


akaash
 
Old 03-17-2004, 05:53 AM   #2
UltimaGuy
Member
 
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 32
You have to make the program executable by compiling it, and then you can just give the path and program name in the script to execute it

For example, compile it as test by doing this
gcc myfile.c -o test

Now, the shell script should be like this :
/[path to test]/test

And you're done
 
Old 03-17-2004, 11:14 PM   #3
akaash
LQ Newbie
 
Registered: Mar 2004
Location: Gujarat, India
Posts: 22

Original Poster
Rep: Reputation: 15
thanx but

i want to call c prog from perl scripts not from shell scripts on linux machine
 
Old 03-17-2004, 11:43 PM   #4
UltimaGuy
Member
 
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 32
Oops, sorry. I think you can use the system call to do this, but I may be wrong.
 
Old 03-18-2004, 07:41 PM   #5
prisoner
LQ Newbie
 
Registered: Jun 2003
Location: North Carolina
Distribution: Mandrake 9.1
Posts: 5

Rep: Reputation: 0
Ultima guy is right. I do this a lot:

system('./mycfile.whatever');

There may be other ways. This always works for me though.
 
  


Reply



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
perl subroutine call shifty_eyes Programming 2 10-01-2005 08:43 PM
call perl cgi script from php j-ray Programming 2 01-14-2005 08:23 AM
call php scripts djgerbavore Programming 3 11-30-2004 07:17 AM
How to Call a C program from Perl CGI Script anoop_cn Programming 1 05-11-2004 04:37 PM
programm.. open call used.. udayan Programming 3 05-17-2002 02:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:33 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration