1) Insure proper prototyping. Start with
#include <stdio.h>
#include <stdlib.h>
int* LoadConfig(char * Filename);
2) Only read 1 digit rather than unlimited digits - this is your main issue
// scanreturn = fscanf(fptr, "%d", &array[i]);
scanreturn = fscanf(fptr, "%1d", &array[i]);
3) Minor: Suggest as it is easier to maintain and more like calloc()
.
// int *array =malloc(sizeof(int)*(poles));
int *array = malloc(poles * sizeof *array);
4) Be sure to free array
in the calling routine when done with it.
free(array);
return 0;
5) Check fscanf()
results
scanreturn = fscanf(fptr, "%d", &n);
if (scanreturn != 1) Oops();
6) Recommend fgets()/sscanf() or strtox()
over fscanf()