As I've already said, the problem is that you have not allocated any memory space for file1char.
You can also take a dynamic approach without much complication, being able to carry out the process in files of any size, since you get character by character:
char Xseqpath[90];
sprintf(Xseqpath, "%s/xseqpath", mainfile);
FILE *File1 = fopen("ref.fasta", "r");
char* file1char = calloc(1,sizeof(char)); //calloc é mais seguro que malloc
int charnumber = 0;
while(fscanf(File1, "%c", &file1char[charnumber]) != EOF)
{
//"charnumber++" retorna o valor anterior de charnumber, e incrementa após retornar.
printf("%c", file1char[charnumber++]);
//Aumenta o tamanho de file1char dinâmicamente
file1char = realloc(file1char,(charnumber+1)*sizeof(char));
}
fclose(File1);
free(file1char);
return 0;
But if you do not need this vector of characters to use for something later, there is no need to save the entire contents of the file to a string, you can only use one character and always assign it to it:
char Xseqpath[90];
sprintf(Xseqpath, "%s/xseqpath", mainfile);
FILE *File1 = fopen("ref.fasta", "r");
char file1char; //1 caracter
int charnumber = 0;
while(fscanf(File1, "%c", &file1char) != EOF) //Salva sobrescrevendo
printf("%c", file1char);
fclose(File1);
return 0;