Hi,
I have a similar problem. I need to read and store information from a file such as:
in int count=7; //count
int float end = 7.5 ; //end
out float myout =0; //my out

I need to store type(e.g. in or out), variable type (e.g. int), variable name (e.g. count), and variable value (e.g. 7). The main problem is that the "=" sign could be joined to the code, as in the first example, or separated by spaces.

Can you please show me how can I do that?

fstream will skip white space for you -- you don't have to do a thing

ifstream in("filename");
string word;
int val1, val2;
while( in >> word >> val1 >> val2)
{
    // do something with these values
}
char direction[4]; // in or out
char type[8]; // such as int, char, etc
char name[25]; // variable name
char value[10];
char filler; // just ignore the = symbol

while( in >> direction >> type >> name >> filler >> value )
{
   // do something with this information

}

Thank very much, I will try that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.