wrote:
>
> Thanks for the info guys.
>
> I am gonna look up and see if I get get somewhere with this, otherwise
> I will just bail out into using perl
(my prof believes it is v.
> easy in c/c++ ... well, we'll see)
It *can* be made very easy and it *can* be made very complicated.
It all depends on what level you want to guard your program
against file format errors.
A simple solution would be:
open file
check for file open errors
std::string type;
int Input[20];
int Output;
while( file >> type ) {
if( type == "AND" || type == "OR" )
file >> Input[0] >> Input[1] >> Output;
if( type == "INV" )
file >> Input[0] >> Output;
...
}
The problem with this code is, that it lacks any sort of handling
input format errors. As long as the file is perfect, it works perfectly.
At the moment someone made a mistake in the file, it all screws up.
--
Karl Heinz Buchegger