Reputation: 45
I am new to C++ programming :). I was wondering what would be the best and easiest approach for this problem.
I have a C++ console application and a Perl script. Both of them are to be integrated. To be more specific need to write perl perlscript.pl arg1
in a cmd prompt (to execute the Perl script). perform few actions in C++ console and keep changing the arguments ( arg1... and so on). there is a limit on the arguments in Perl script that depend upon outcome of my C++ console application.
I could write a Perl script using the Win32API module to pass commands to different command prompts and get results and so on. But this is very inefficient way of doing things.
I would appreciate for a much better solution or direction to think.
Upvotes: 1
Views: 3890
Reputation: 118166
If you do decide to embed perl
in your program, see perldoc perlembed.
Upvotes: 2
Reputation: 186098
It's only "very inefficient" if it has a noticeable impact on the performance of your program. Since it is very easy to call the system()
function, you should try this first and see for yourself. Only then should you consider other options.
Since any other approach is going involve considerably more work, trying to improve the code before profiling it is premature optimisation.
Upvotes: 3