My code works fine for smaller integers, but when it gets over 1 million or so the number changes or goes negative. I am sure this has to do with the range of int, but I tried float and double and all the numbers came out the same...... What is a proper way of reading in an integer (say 5895685684568)?
void numFromFile(char file []){
txtFile=fopen(file, "r");
if(txtFile!=NULL){
int num; //value in which the int is read in and inserted into the B-tree
fscanf(txtFile,"%d", &num);
while(feof(txtFile)==0){ //while not at the end of the file do:
cout << num << "\n";
insert(num, root);
fscanf(txtFile,"%d", &num);
}
fclose(txtFile); // reading in words is done. The file is closed.
}
}