I downloaded a software package online. Assume the package is called aPackage.zip. After unzip the folder, it contains a executable file Cassie.exe and it takes 2 input files, file1.txt and file2.txt. I just need to double click the Cassie.exe and it automatically start running fine. Now I would like to measure how much time it takes to run Cassie.exe so I wrote a small c++ program (main.cpp) of a new project(TimeMeasure) in Visual C++ 2010 express. However, although I put Cassie.exe, file1.txt and file2.txt inside the same folder, Cassie.exe still keeps complaining it can not open file2.txt. Here are the codes of main.cpp of project TimeMeasure.
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h> /* printf */
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */
#include <math.h> /* sqrt */
using namespace std;
int main () {
const clock_t begin_time = clock();
system("C:\\aPackage\\Cassie.exe C:\\aPackage\\file1.txt C:\\aPackage\\file2.txt");
ofstream myfile;
myfile.open ("Time.txt");
myfile << "Time used is %d sec \n"<<float( clock () - begin_time ) / CLOCKS_PER_SEC;
myfile.close();
system("PAUSE");
return 0;
}
The TimeMeasure project is created at path
C:\Users\Cassie\Documents\Visual Studio 2010\Projects\TimeMeasure
This is why I use the absolute path for the aPackage folder. My pc is window 7 home OS system. Can anyone tell me what I did wrong ? Thank you very much,