Computing.Net > Forums > Programming > system() c++ perl .bat

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

system() c++ perl .bat

Reply to Message Icon

Original Message
Name: collegeguy
Date: February 17, 2005 at 16:02:32 Pacific
Subject: system() c++ perl .bat
OS: win 2000
CPU/Ram: 2 ghz, 1 gb
Comment:

Hello,

Im trying to invoke a simple perl script with in my visual c++ gui
program to with c++'s system call feature:

when i call:

system("dir");

it works

when i call:

system("c:\perl\bin\perl.exe c:\temp\perl.pl");

it does not work

when i cut and paste

c:\perl\bin\perl.exe c:\temp\perl.pl

into the command line, it works.

Does anyone know why?

Thanks,

AG


Report Offensive Message For Removal


Response Number 1
Name: Fozzie
Date: February 17, 2005 at 17:48:47 Pacific
Reply:

Yes, I do.


Report Offensive Follow Up For Removal

Response Number 2
Name: Fozzie
Date: February 17, 2005 at 17:52:31 Pacific
Reply:

:)

Ok, here's how to make it work.

Use

system("c:\\perl\\bin\\perl.exe c:\\temp\\perl.pl");

instead.

In C++ the compiler sees "\" as the start of an escape command. For example \n starts a new line.

Type "\\" when you want to use the actual \ character.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home



Results for: system() c++ perl .bat

C++ system() and variables?
    Summary: That's doable. Also, if I'm using something wrong or incorrect, please let me know :) /* A personal test / replacment for Windows Search utility */ #include <iostream> #include <fstream> using n...
www.computing.net/answers/programming/c-system-and-variables/11796.html

PERL system() command issue
    Summary: Hi, I am using system() in Perl to temporarily stop the Perl script from running and to execute my C++ program that does some analyzes work. I think the program runs but there is no analyzes output o...
www.computing.net/answers/programming/perl-system-command-issue/6491.html

C Program System()
    Summary: Ok, would it be possible to run a batch file in system()? For example: system("properties"); or system("call properties.bat") If not, I will have to find some alternative way. Basically what I want to...
www.computing.net/answers/programming/c-program-system/15348.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software