By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

executing perlprogram in c++ program.....

P: 6
hi all,
Expand|Select|Wrap|Line Numbers
  1. #include<stdlib.h>
  2. #include<iostream.h>
  3. void main()
  4. {
  5. cout<<"main1234\n";
  6. system("perl perlsample.pl");
  7. cout<<"invoked";
  8. }
  9.  
when we were trying to execute it was calling th perl program before anyother
statements in main
how this program could be executed in a proper sequence rather than perl program executing in the first

thanks in advance................................
Aug 9 '07 #1
Share this Question
Share on Google+
2 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
hi all,
Expand|Select|Wrap|Line Numbers
  1. #include<stdlib.h>
  2. #include<iostream.h>
  3. void main()
  4. {
  5. cout<<"main1234\n";
  6. system("perl perlsample.pl");
  7. cout<<"invoked";
  8. }
  9.  
when we were trying to execute it was calling th perl program before anyother
statements in main
how this program could be executed in a proper sequence rather than perl program executing in the first

thanks in advance................................
I get a bunch of errors when trying to compile your program. I have updated it below:

Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    cout<<"main1234\n";
  6.    system("perl perlsample.pl");
  7.    cout<<"invoked";
  8.    return 0;
  9. }
  10.  
That gives me the proper output in the proper order...
Aug 9 '07 #2

Expert 10K+
P: 11,448
I get a bunch of errors when trying to compile your program. I have updated it below:

Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    cout<<"main1234\n";
  6.    system("perl perlsample.pl");
  7.    cout<<"invoked";
  8.    return 0;
  9. }
  10.  
That gives me the proper output in the proper order...
@OP: also please note that the erroneous 'void main()' was correctly replaced
by 'int main()'. Please keep that in mind.

kind regards,

Jos
Aug 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.