4
The idea of this method is to write all the words of a list of nodes in a binary file. I have a linked list of nodes, where each node has two information, its information, and a reference to the next node in the list. The idea is to write the information of each node in a binary file. However, I am getting the following error:
Warning: incompatible Pointer to integer Conversion assigning to 'char' from 'const char *'
Which occurs on this line of the code:
*pal = nodo->info;
I just don’t understand what the problem is, since my structure defines the information of the node as a pointer as well. Below is the NODO structure code and method
typedef struct Temp{
char const *info;
struct Temp *prox;
}TNODOPAL;
Method :
void escreveBinario(){
TNODOPAL *nodo = inicioPal;
FILE *fp;
char *pal = NULL;
fp = fopen( "binary.dat" , "wb" );
if (fp == NULL) // Se não conseguiu criar
{
printf("Problemas na CRIACAO do arquivo\n");
return;
}
while(nodo != NULL){
*pal = nodo->info;
fwrite (&pal, sizeof(char) * 30, 200, fp);
nodo = nodo->prox;
}
fclose(fp);
}
I just noticed that the created file is empty. You know what the possible problem might be?
– GGirotto