You have tried to open either a standard input file with output mode, or some other file in an incorrect mode.