-
Oct 23rd, 2007, 07:40 AM
#1
Thread Starter
Lively Member
question re: system() command
Hello,
I am trying to execute a program called "first.exe" which is located in a folder called c:\temp\programs.
I get an error when trying to compile this:
#include <iostream.h>
#include <stdlib.h>
void main()
{
system ("file:///c:\temp\programs\first.exe");
}
I can't seem to figure this one out --- any ideas would be most welcomed!
Thanks
-
Oct 23rd, 2007, 02:42 PM
#2
Re: question re: system() command
In C/C++, the backslash character in a string is an escape character -- it tells the preprocessor that you are trying to specify a special character. For example, \t means tab, \n means new line, and so on. So when you want to use an actual backslash, you have you 'escape' it as well -- by putting a backslash in front of it:
Code:
system ("file:///c:\\temp\\programs\\first.exe");
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|