Jump to content

Calling A Perl Script From C

RobL

Hey all :)
 

So recently I have been trying to create a program to greet a user on startup. I no they probably already exist but im just bored and wanted to do it myself :P

 

I have written the code in C and i wanted the user to be able to choose from a list of programs to launch from within the program, now it is very very simple to make a program launch using a PERL script but I just dont know how to exectue the PERL script from inside the C code, can anyone help??

 

**Note** I want to use C for this so please dont tell me to use something else :P

Link to comment
Share on other sites

Link to post
Share on other sites

This is really a platform-specific issue, but assuming you're using Windows:

 

http://msdn.microsoft.com/en-us/library/bb762153%28v=vs.85%29.aspx

 

Basically, this will allow you to use the Windows API to run a shell command, and from there you can have it execute the perl script.

(I've personally never used the Windows API, so forgive me if I am wrong)

Link to comment
Share on other sites

Link to post
Share on other sites

This is really a platform-specific issue, but assuming you're using Windows:

 

http://msdn.microsoft.com/en-us/library/bb762153%28v=vs.85%29.aspx

 

Basically, this will allow you to use the Windows API to run a shell command, and from there you can have it execute the perl script.

(I've personally never used the Windows API, so forgive me if I am wrong)

Not using windows lol. I always use linux for coding as, I personally feel, everyone should :) which i no isnt a very popular opinon here but o well lol.

Link to comment
Share on other sites

Link to post
Share on other sites

Then, from a quick google, you can use system("shell command here"); to execute a shell command on Linux.

Link to comment
Share on other sites

Link to post
Share on other sites

Then, from a quick google, you can use system("shell command here"); to execute a shell command on Linux.

ya figured that out pretty much right after lol :P I was reading something about a deamon or something it was very confusing lol so thats why the qestion was posed thanks again though

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×