This is a c++ Code. I want to write a pointer to a struct in file. When I try to do so it generates an error. I did is >> obj1[0].contentAdress; in main.
struct node3{
node3(){
nextContent = NULL;
for (int i = 0; i<1020; i++)
content[i] = '\0';
}
char content[1020];
node3* nextContent;
};
//-------------------------------------------------------------------------------------------
struct node1{
node1(){
for (int i = 0; i<496; i++)
fileName[i] = '\0';
}
char fileName[496];
node3* contentAdress;
};
//-------------------------------------------------------------------------------------------
int main(){
node1 obj1[2097];
node3 obj3[8192];
ifstream is("file.txt");
//I want the obj1[0].content Address to be written in file. For that I did:
**is >> obj1[0].contentAdress;** *THIS GENERATES AN ERROR*
return 0;
}
ERROR:
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'node3 *' (or there is no acceptable conversion)
>>input operators, it is written in C++. Please be careful and consistent in your tagging, and generally avoid dual tagging with C and C++. That often brings down the ire of those who look at questions — they are very different languages, and an appropriate answer for C is often inappropriate for C++, and a good answer for C++ often simply doesn't work (as in, 'will not compile') in C.