I have declared an array: names[1000];
and another array, data[1000];
, to store the data temporarily
and later used an ifstream
to read data from an XML
file.
then later, I used cin.getline(data, 300)
to put the data into data[]
array.
but when I assign data[]
array to names[]
array, an error occurs:
invalid operands of types char[1000] and char[1000] to binary operator>>
code:
char data[1000];
char names[1000];
ifstream openFile("myfile.xml");
if(!openFile)
{
cout<<"File not found! please re-enter filename"<<endl;
}
while (openFile.getline (data, 300))
{
if (data[0] == '<' && data[1] == 'n') // to only check the <name> xml tag
{
cout<<data<<endl;
data >> names;
}
}
Any idea why I cant assign data array to names array?
Thanks!