int main ()
{
cout << "programmer: darren sandusky " << endl;
cout << "this program decodes input text file and sends it to and output file and console " << endl;
ifstream fin;
fin.open ("secret.txt");
if (!fin.good ()) throw "I/O error";
string linefromfile;
int i;
while ()//this is infinite
{
getline (fin, linefromfile); //this should read to end of file on its own, but it isnt
for (int i = 0; i < linefromfile.length(); i++)
linefromfile[i]--;
cout << linefromfile << endl;
}
ofstream fout;
fout.open ("secret.txt", ios :: app);
if (!fout.good()) throw "I/O error";
the reason your while loop will not stop is because you have not set any conditions for it.
Although I don't really know how to help you right now ( after midnight my brain shuts down ), you are most likely going to need to find a way to tell this code when your while function is done.
thats the problem. It should read the file once and be done. I have looked at the end of file stuff in my book and on this website, but I don't know what condition to set to end the file reading. I have tried if break, putting things where inside the parenthesis in while (), etc... Also, that is why I think the getline is messed up. It should read all the lines, not the first one...