Hi I am writing a game that uses several text files for its data, and I was wondering how to store the entire data within the text file in a single character string of the char *.
I figured something like this should do it:
But obviously there must be a better way. If not then could some one tell me how to do it this way?Code:FILE *file
char ch;
char *data;
while ((ch = fgetc(file)) != EOF)
{
/* Function to append ch to the end of data */
}