I have been struggling scanning the following line of textfile into a char matrix :
O A B C D E T
What i tried was this :
fscanf(ifs, "%c %c %c %c %c %c %c",
graphe->name[0][0], graphe->name[1][0], graphe->name[2][0],
graphe->name[3][0], graphe->name[4][0], graphe->name[5][0],
graphe->name[6][0]
);
For information: ifs
is the file pointer, and the .txt file is opening well.
I'm precising that name is a char**
because i might replace the letters with words someday. Thus, the string length might need to be increased.
Name is a char**
being allocated as:
graphe->name = (char**) malloc(sizeof(char*)*graphe->ordre);
for(int i=0;i<graphe->ordre;i++){
graphe->name[i] = (char*)malloc(sizeof(char));
}
For some reason, this is not working, am I doing anything wrong? Are there better practices in order to accomplish the same task ?