The %freopen() function substitutes the named file specified by str in place of the opened stream stream1.
stream = (char*)%freopen(str, type, (char*)stream1)
The stream is returned as a pointer to a character or 0 if an error has occurred. system(0) is then set to the error number.