Hi, i tried to compile the code below but got an error where SEEK_END and SEEK_CUR is. The error is: 'Error could not find a match for 'istream::seekg(long,int)'
The code below is an example from a book ,the alph.txt is a text file containing the letters of the alphabet (atached)and the program below prints them on the screen in reverse order . Am using borland TC 3.0 compiler. Please if you could compile the code and tell me if it works for you, or if am doing something wrong.
Thanxs for your help.
[CODE]
----------------------------------------------------------------------------------
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
ifstream fp;
void main()
{
char in_char;
fp.open("Alph.txt", ios::in);
if(!fp)
{
cout<<"**Error opening file**\n";
exit(0);
}
fp.seekg(-1l,SEEK_END);
for(int ctr=0; ctr<26; ctr++)
{
fp>>in_char;
fp.seekg(-2l, SEEK_CUR);
cout<<in_char;
}
fp.close();
return;
}
-----------------------------------------------------------------------------
p.s To make the above program work instead of
(-1l, SEEK_END) i used (-1l, ios::end)
Is there any difference between this two comands ?
As you can tell am new to programming so i would apriciate any
comments that can help me. Thanxs.