void recupEntrees(){ //read the file and take lines
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
index Id; //this is a BST
fp = fopen("./test.txt", "r");
if (fp == NULL){
exit(EXIT_FAILURE);
}else{
while ((read = getline(&line, &len, fp)) != -1) {
ajouter(Id, line); //add line in a BST
}
}
//if (line) delete(line);
fclose(fp);
}
void ajouter(index &ind, char* mot){
//convert char* mot to string
if (index==0){
index aux;
aux=new boite;
}
Thanks a lot
by the way: there is a standard getline function which reads directly into a std::string. So you don't need your self-made getline (which, I bet, is leaking memory ;) )