Mail Archives: djgpp/2001/09/24/14:17:40
Chris Smith <herrsmitty AT erols DOT com> wrote in
news:3BAF4C56 DOT 3F2904BC AT erols 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:
>
try the following:
#include <fstream>
int main(int argc, char *argv[])
{
char c;
int i;
int myeof;
ifstream fin(argv[1], ios::binary);
if( fin == NULL )
exit(1);
fin.seekg(0, ios::end);
myeof = - ( fin.tellg() + 1);
for( int i = -1; i > myeof; --i)
{
fin.seekg(i, ios::end);
fin.get(c);
cout << c;
}
fin.close();
return 0;
}
--
--------------------------------
A. Sinan Unur
http://www.unur.com/
- Raw text -