fopen - C++ Reference -

2) Same as (1), except that the pointer to the file stream is written to streamptr and the following errors are detected at runtime and call the currently installed constraint handler function: streamptr is a null pointer ; filename is a null pointer ; mode is a null pointer ; As with all bounds-checked functions, fopen_s is only guaranteed to be available if __STDC_LIB_EXT1__ is defined by FILE *FH; FH=stdin; int buff; while((buff=getc(FH))!=EOF) { //stuff } That's simplified, as FH needs to point to either a file or stdin. For testing I'm just writing the buff out to a file to see the changes. The code works perfectly if FH is a file. I've seen the same behavior on using tar, type, and cat as the pipe source A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. Opens the file whose name is specified in the parameter filename and associates it with a stream that can be identified in future operations by the FILE pointer returned. The operations that are allowed on the stream and how these are performed are defined by the mode parameter. The returned stream is fully buffered by default if it is known to not refer to an interactive device (see setbuf). The freopen function opens the file whose name is the string pointed to by path and associates the stream pointed to by stream with it. The original stream (if it exists) is closed. The original stream (if it exists) is closed.

[index] [14335] [26412] [24700] [12975] [27358] [18618] [17108] [101] [1184] [21916]

Flag Counter