program.exe < testscript.exe
You probably meant to type
program.exe < testscript.txt ?
You can provide command line options under the menu "Project" --> "Set program's arguments". This is as close to what you want as possible. It does
not redirect input, though (which you want). You could modify your program to work that way by adding 3-4 lines of code, though (which is the "correct" behaviour, anyway).
You can get input reditrection if you add a post-build step like
cmd /C program.exe < testscript.txt. Note that this will run the program every time you build, and it will not show a console, but dump the output to the log window. Also, if your program freezes, Code::Blocks will wait forever (or until you kill the program).
short c = fgetc(stdin);
As a sidenote, this is the most inefficient way to read a file (you probably know). Reading in big chunks (or the whole file in one go) is often a lot faster.