I created this function for my program :

int calcTotal()
{
	petShop p;
	fstream f1;
	f1.open("Pet_Shop.dat",ios::app|ios::binary);
	int loc;
	loc=p.tellp();
	float records;
	records=loc/sizeof(p);
	cout<<"Total number of records = "<<records;
	cout<<"Going back to main menu";
	menu();
}

I am getting this error :

error C2039: 'tellp' : is not a member of 'petShop'

Isn't the tell() function available in <fstream> libaray?
Anyways, how do I fix it?

>error C2039: 'tellp' : is not a member of 'petShop'

Yes. Its a member of fstream[/B.


loc=f1.tellp();

>error C2039: 'tellp' : is not a member of 'petShop'

Yes. Its a member of fstream[/B.


loc=f1.tellp();

Thanks. Problem Solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.