test for input from stdin

I am writing an application that will receive data either from a file or from standard in. It can be run stand-alone, and read from a file, or in a job stream and read data piped to it from a previous program. In this case the previous program may also create or alter a control file, so the application needs to wait until it is finished and actually writing data.
Is there a way to test if standard in is connected to another process? And if it is wait until data is available before the application starts processing?
I tried select () but that will only tell if data is available at the time, not if it will be available soon.

Thanks
Topic archived. No new replies allowed.