How to check whether an opened file is in read mode or write mode i.e. "r" or "w"?
Note that the file was opened using fopen command and it has to be in a standard way instead of platform-specific hacks.
EDIT 1:
It seems that the FILE data structure is implementation-dependent. The only way to get it must be in the FILE.flags variable however in my Mingw32, it has only FILE._flags.