here is code[

#include<iostream>
#include<fstream>
#include<conio.h>
using namespace std;
struct book_dtail
{
	int copies;
	char title[50];
	char author[50];
	int year;
	char **bn;
};
void main()
{
	int size;
	ifstream indata;
	book_dtail user_book[5];
	indata.open("file path to be added here");
	for(int count=0;count<5;count++)
	{
		indata>>size;
		user_book[count].copies=size;//2D array initialized.
		user_book[count].bn=new char*[size];
		for(int temp=0;temp<size;temp++)
		{
			user_book[count].bn[temp]=new char[4];
		}
		indata.getline(user_book[count].title,50);
		indata.getline(user_book[count].author,50);
		indata>>user_book[count].year;
		for(int temp=0;temp<size;temp++)
		{
			indata.getline(user_book[count].bn[temp][4],50);//(error in this line)"error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::getline(_Elem *,std::streamsize)' : cannot convert parameter 1 from 'char' to 'char *'"
		}
	}
}

]
//i dont know cause of error , nd also how to remove it

Recommended Answers

All 2 Replies

user_book[count].bn[temp][4] is a single character. Change it to user_book[count].bn[temp]

thanks so much WaltP..it worked....(it wz stupid mistake :s)

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.