A
aldonnelley
Hi there,
I'm working with BCB6, and I'm having a strange error. I've tried
to find a solution elsewhere, but I've got everyone scratching their
heads...
What's happening is that any exe I build in BCB6 that opens another
file will run fine if I run it from the IDE, and will run if I
double-click the exe, but when I try to run it from the command line,
it doesn't find the file specified. That is, I'll get the error code
specified for a file not found.
I've written a simple 'readlines' script to eliminate the possibility
that there's some problem with the more complex scripts I'm trying to
run, and I still have the same problem. (script attached)
The file "haarcascade_frontalface_alt.xml" is in the project folder
with the exe, and I've added that folder to the include path and
library path (not that that's necessary for this script, I think).
Obviously, for this script, I get the "error opening output file" error
message.
Anyone have any ideas what I'm doing wrong? Any and all assistance
would be greatly appreciated.
Cheers, Al.
//Code Starts
//---------------------------------------------------------------------------
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main()
{
string str;
ifstream haarfile("haarcascade_frontalface_alt.xml");
if (!haarfile) //test file open
{
cout << "error opening output file" <<endl;
return -1;
}
while (! haarfile.eof()) //loop through lines
{
getline(haarfile, str);
cout << str << endl;
}
haarfile.close();
return 0;
}
//---------------------------------------------------------------------------
//Code ends
I'm working with BCB6, and I'm having a strange error. I've tried
to find a solution elsewhere, but I've got everyone scratching their
heads...
What's happening is that any exe I build in BCB6 that opens another
file will run fine if I run it from the IDE, and will run if I
double-click the exe, but when I try to run it from the command line,
it doesn't find the file specified. That is, I'll get the error code
specified for a file not found.
I've written a simple 'readlines' script to eliminate the possibility
that there's some problem with the more complex scripts I'm trying to
run, and I still have the same problem. (script attached)
The file "haarcascade_frontalface_alt.xml" is in the project folder
with the exe, and I've added that folder to the include path and
library path (not that that's necessary for this script, I think).
Obviously, for this script, I get the "error opening output file" error
message.
Anyone have any ideas what I'm doing wrong? Any and all assistance
would be greatly appreciated.
Cheers, Al.
//Code Starts
//---------------------------------------------------------------------------
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main()
{
string str;
ifstream haarfile("haarcascade_frontalface_alt.xml");
if (!haarfile) //test file open
{
cout << "error opening output file" <<endl;
return -1;
}
while (! haarfile.eof()) //loop through lines
{
getline(haarfile, str);
cout << str << endl;
}
haarfile.close();
return 0;
}
//---------------------------------------------------------------------------
//Code ends