I don't believe there's a way to ask NetBeans to pipe input to your program (that functionality is handled by your shell). If you want to test or debug your program in the IDE, the best way is to allow it to take a filename as a parameter, or fall back on standard input if no filename is given. Then you can adjust your project run configuration and supply the test filename as an argument.
Note that if you try to use "< file" in the run configuration, that will simply be passed directly to your program, because there is no shell intercepting it.
[Edit] I found a way, though it's a bit weak.
NetBeans (at least on my Mac) runs C++ programs via a script called dorun.sh, which is under the .netbeans folder in my home directory. It includes a line near the end like this:
"$pgm" "$@"
The quotes escape any use of the < operator in your project properties, so you could remove the quotes (and accept the consequences), or include a < between them:
"$pgm" < "$@"
and simply include the filename as an argument.
If you don't know where to find the arguments, it's in the project properties, off the file menu.
If you're using NetBeans on Windows, I'm not sure what kind of script (if any) it uses to launch your program. Also note that this doesn't work if you use the output window instead of an external terminal (this setting is in the same window).
[Edit edit] This is also no good when trying to debug your program... probably best just to amend your code to deal with reading from either a file or stdin.