To make as few changes to your code, you can do something like this
FILE *fre;
int re_rng;
fre = fopen("vals", "r");
if (fre==NULL){
printf("Error");
}
while (fscanf(fre, "%d", &re_rng) == 1)
{
printf("%d\n", re_rng);
}
Things to note: You put wrong specifier at in the fopen, a
means append, it is opening the file for writing at the end of the file. You want to use r
for reading.
You need to check if the file is ok right after you opened it. If you first try to read and then check, if it failed the program will end with segfault probably.
You can also move the fscanf into the condition for while, where it returns number of conversion made, meaning for you that it returns 1 when it reads a number, 0 when it fails to read a number and -1 when it's at the end of file.
I would suggest you try to read about all of these functions (+feof) at some documentation sites like cppreference.com.