.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to position pointer using tellg and seekg

ad+1

Program -


#include<fstream.h>
#include<stdlib.h>
#include<conio.h>
const int size=10;
void main()
{
int pos=0;
ifstream fin("raj.dot");
char ch;
fin.seekg(8);
while(fin.get(ch))
{
cout<<ch;
if(ch==""||ch=="#")
{
pos=fin.tellg();
cout<<"\n position of"<<ch<<"is"<<pos;
continue;
}
}
getch();
}

Output - 

position of (blank) is 9
management
position of (blanks) is 20
#
position of # is 21
systems


0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates