Message-ID: <3BAF4C56.3F2904BC@erols.com> Date: Mon, 24 Sep 2001 11:08:06 -0400 From: Chris Smith X-Mailer: Mozilla 4.72 [en]C-CCK-MCD DT (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: read a file backwards Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hello everyone, I am working on a small encryption utility program. At one point in the program I need to be able to read a file backwards. Have I missed something specific about djgpp, or have I just over looked the obvious? Below is a sample of the code I am attempting to use: #include int main(){ // pick a file to open char file[] = "somefile.txt"; // open the file stream in binary mode ifstream SOURCE(file,ios::binary); if(!SOURCE){exit(1);} // set up a variable to hold what we read char current = '\0'; // goto the end of the file SOURCE.seekg( 0 , ios::end ); // get the end of the file, -1 for 0-based counting int TheEnd = -1 * (SOURCE.tellg() - 1); // loop through the file for( int i = -1 ; i > TheEnd ; i-- ){ SOURCE.get(current); cout<