this program is just messing around with file i/o, and then i stumbled across something that i¨ve clearly forgot or missed in the tutorials i've read. my 'guess' is its the to if statements messing up (or perhaps rather their else's)
i know i used goto and that means i am a moron so comments about that are welcomme too (as for anything else i may have done in wierd ways:P )
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream ud;
ud.open ("C:\\Documents and Settings\\Happy\\Skrivebord\\testfile.txt", ios::app);
crashstart: //for the goto later on
string userin;
cout<< "\ninput for file\n";
cin >> userin;
ud << userin;
ud.close();
if (ud.is_open()) //this is where trouble begins i think, altso i //dont know of this is neccesary but i want to do it just to get the //hang of it.
{
cout << "\nur screwed, the file cant close, shutdown anyway? y/n \n";
string shutdownyn,y="y", Y="Y", n="n", N="N";
cin >> shutdownyn;
if (shutdownyn==y || shutdownyn==Y)
{
goto faseout;
}
else
{
goto crashstart;
}
else //this one right here is the little satan i believe?
{
goto faseout;
}
}
faseout:
cout << "\nprogram terminated\n";
cin.get();
return 0;
}