Hi, I'm trying to make a program that will write to a file and tell it that the next time that the program is run to not do the first part of the program.

fstream install;
//this is what all of the tutorials say to do.
 install.open(ready.txt);
//this is supposed to open the file for writing and reading (this is an fstream instance so //the default is to have both)
if(install==is_open())
{
cout << "it worked!";
}
else
{
cout << "fail";
}

when I run this, it say that: "variable ‘std::fstream install’ has initializer but incomplete type"

Does anyone have an idea?
even the program that the tutorial provided isn't running... what am I doing wrong (This process has worked before but I can't figure out where that program is...)

The if statement on line 5 is wrong. You should be calling one of ifstream's metods. Sould be like this: if( install.is_open())

That's Great! I found that There were problems with almost all of the things dealing with the f/i/o stream classes...

The book that I have doesn't make a ton of sense.

Thanks, J.t.

Now I want the user to input the place of the file being read. This isn't working for just one reason: Apparently, the declaration of the fstream class isn't correct...

The declaration is just fstream ready; and then later

ready(apply,ios_base::trunc|ios_base::out);//apply is the var where I'm asking the user to put the location into.

Thanks,
jt

call:

ready.open(apply,ios_base::trunc|ios_base::out);
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.