im newbees in doing C++ program, now i face a problem where i need to open more than one ".dat" file in a single program. the coding that i use is...
ifstream input;
input.open("Luc.dat");
if (input.fail())
{
cout<<"Unable to open a file \n";
exit(1);
}//end if
while(input>>keyword>>index2)
{//write to Alphabet Array
LUC[x].setkeyword(keyword);
LUC[x].setindex2(index2);
x++;
}//end while
input.close();
it have no problem when i juz use that code to open one file, but when i wana open the second file for example "ltc.dat", at the next process,i use the same method but the system become error.
the error message is ...
Fault: access violation at 0x4013ac; write at address 0x30cb0.
somekind like that........ can anybody help me to solve this problem? im using Borland C++ 5.02 to compile the program.
thanks