Originally Posted by
bodyboarder91
Almost at the point of giving up on this. I have been reading the link on fread that you have posted but I am getting more confused. When you say place your buffer in main which part of this do you mean?
Something like this:
Code:
#include <stdio.h>
#include <stdlib.h>
void openfile(char**);
void loadMenu2(char*);
int main(void){
char *buffer=NULL;
//your case statements here
//For case1:
openfile(&buffer);
loadMenu2(buffer);
return(0);
}
void openfile(char **buffer){
//open file and obtain size
*buffer = malloc(lsize * sizeof(char));
if(!(*buffer)){
printf("Error with malloc");
exit(1);
}
//read your file into buffer, using *buffer
}