I am trying to read in hexadecimal from a text file, currently this is what I have
void hexReader(char* file, node* head){
FILE *fp;
char str[MAXCHAR];
size_t number = 0;
fp = fopen(file, "r");
if (fp == NULL){
printf("Could not open file %s",filename);
//return 1;
}
while (fgets(str, MAXCHAR, fp) != NULL) {
//while ((number = getline(&line, &len, fp)) != -1)
number = strtoull(str, NULL, 16);
if (number > 0){
printf("%size_t \n",number);
printf("%x \n",number);
}
}
fclose(fp);
}
I have tried using unsigned long long for number but it fails on hex like FFFFFFFFFFFFFFF. I should be able to read in things like that, in the form of 0x....up to a 64 bit hex number.
Why is this failing? Size_t prints out nonesense and unsinged long long fails on too large of numbers.