Problem Reloading a External File

Hello,

I've been working on a little program for a while now, I recently added a piece of code that retrieves a file named 'Help.cryo' and displays all the contents (It just displays the available commands ). While this works fine; the problem occurs when I try to access it again.

I state it
ifstream help ("Help.cryo");
I call the loop and the get the Help file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
do
{
 if (help.is_open())
                          {
                                     while ( help.good() )
                                                {
                                                        
                                                  getline (help,help_inline);
                                                  cout << help_inline << endl;
                                                  
                                            
                                                }
                                help.close();
                          }
                          
                          
               else cout << "Help File can not be found.\n"; 
}  



When I try to reopen it, it reads it can not be found. I feel like this is a simple problem but confusing to me. Any help would be lovely, thank you!


An example is:

> Help
(Displays all the contents of 'Help')

> Help
Help can not be found
Well, i don't use ifstream too much, but i think that it doesn't allow to reopen the file.

Put that ifstream help ("Help.cryo"); within your loopt (after do {) should help.
you forget
 
help.clear();

Well, i don't use ifstream too much, but i think that it doesn't allow to reopen the file.

Put that ifstream help ("Help.cryo"); within your loopt (after do {) should help.




I do believe that helped. Thank you





you forget


help.clear();



While the first edit I tried, didn't work, I complied and ran it with it still in, so it maybe helped, thank you anyways.
Topic archived. No new replies allowed.