0
I have the task of reading a file and uploading its information to a B tree structure, in order to develop a search algorithm to search the information by name, but my difficulty is already in the beginning, it’s my first time using this kind of tree structure and I can’t handle the same.
I believe the structure of such a tree is like this:
typedef struct { //estrutura do arquivo a ser lido
char uf[3];
char municipio[61];
long long nis;
char cpf[15];
char nome[61];
int parcela;
float valor;
int p; // posição do registro que contém a subárvore direita
} arvb_info;
struct no_arvb {
int m; // número de chaves no nó
int p0; // posição do registro que contém a primeira subárvore
arvb_info chaves[100]; // vetor de elementos
};
And then I’m reading the file like this:
printf("\tEntre com o nome do arquivo: ");
scanf("%39[^\n]", filename);
if ((arq_dados = fopen(filename, "r")) == NULL) {
fprintf(stderr, "\tErro de abertura do arquivo %s!\n", filename);
fclose(arq_dados);
return 1;
}
If someone could give me a light or a way to carry the information in such a structure would be of great help!