Hello :)
I'm creating a license plate recognition system for my coursework at University. We need to use Binary trees, which I've done but the information needs to be stored in a file to read and write to. I've created some text files with XML tags in for Cars, Lorries, Buses and Motorbikes and I've written some of the code below, but the "File to open" bit my tutor helped me with. When I run the program, it says "File to open" and I'm not sure what I need to do? Would anyone be able to help me?
int _tmain(int argc, _TCHAR* argv[])
{
char tags[MAX_VEHICLES];
void * vehicles[MAX_VEHICLES];
ifstream infile;
if (argc >1)
{
//filename passed as command line argument
//set in Project->Properties->Configuration->Debugging
infile.open(argv[1]);
}
else
{
string fileName;
cout << "File to open" << endl;
cin >> fileName;
infile.open(fileName.c_str());
}
int c = 0;
string inputLine;
while (!infile.eof() && (c< MAX_VEHICLES))
{
getline(infile, inputLine);
tags[c] = inputLine[0];
switch (tags[c])
{
case 'C': vehicles[c] = buildC(inputLine); break;
case 'B': vehicles[c] = buildB(inputLine); break;
case 'L': vehicles[c] = buildL(inputLine); break;
case 'M': vehicles[c] = buildM(inputLine); break;
default: cout << "error with tag " << endl;break;
}
++c;
}
Thanks :)