hi, my app is similar this below:
	
	- fstream file; 
- while ((choice=getchar()) != '0' ) {  
-      if (!file.open(file_name.c_str(), std::ios_base::in)) {  //read only 
- 		if ((file()).eof()) 
- 			cout << "end file \n";					 
- 		cerr << "unable to open that file\n"; 
- 		return -1; 
- 	}        
-  	while ( c=file.get(); ) {  
- 		cout.put(ch);  
- 	}	 
-       	f.close(); 
- } 
        fstream file;
while ((choice=getchar()) != '0' ) { 
     if (!file.open(file_name.c_str(), std::ios_base::in)) {  //read only
		if ((file()).eof())
			cout << "end file \n";					
		cerr << "unable to open that file\n";
		return -1;
	}       
 	while ( c=file.get(); ) { 
		cout.put(ch); 
	}	
      	f.close();
}
To copy to clipboard, switch view to plain text mode 
  I read all file and at the end of first cycle I close the file; but the second cycle, program terminate because file seems to be at the end. Why? I supposed if I close and re-open it goes at begin....thanks
				
			
Bookmarks