I am having trouble accepting input from a text file. My program is supposed to read in a string specified by the user and the length of that string is determined at runtime
You can also use fread, where you can set a read limit:
char string[5]={0}; if( fread(string,(sizeof string)-1,1,stdin) ) printf("\nfull readed: %s",string); else puts("error");