How would I use input from a text file so that I could use it in a function, without saving the characters into an array? As I read from the text file a 1 will come up and I will go to "setParameters", where I would enter the rest of the parameters. Also in that function, I will use malloc.(if it does not make sense let me know so that I can clarify it, also I am new to C)
int val;
int choice;
FILE *fpointer;
fpointer = fopen("afile.txt","r");
printf("\nError Detection/Correction");
printf("------------------------------\n");
choice = fscanf(fpointer,"%d",&val);
while(choice != 3)
{
printf("1. Enter Parameters\n2. Enter Hamming Code\n3. Quit\n");
switch(choice)
{
case 1: setParameters();
break;
case 2: checkError();
break;
case 3: printf("*** Program Terminated Normally");
break;
default:
printf("Not a valid entry");
break;
}//end of switch statment