hshliang
asked on
How do I get the access mode that was used to obtain a pariticular file (or file handle)?
I am trying to write a generic file read programe that accept either a CFile or a file handle.
However, when testing it, I sometimes get error because the file was open in an unexpected mode (like write only etc), hence, I would like to examine the CFile or file handle that is passed to the me and see if it is open appropriately. However, I find that there is NO way to examine the way the file was opened (like with 'r' or 'w' etc).
Can any one tell me if there is a way ( as easy as possible) to examine the mode that was used to open this particular file? to avoid errors.
Thank you
However, when testing it, I sometimes get error because the file was open in an unexpected mode (like write only etc), hence, I would like to examine the CFile or file handle that is passed to the me and see if it is open appropriately. However, I find that there is NO way to examine the way the file was opened (like with 'r' or 'w' etc).
Can any one tell me if there is a way ( as easy as possible) to examine the mode that was used to open this particular file? to avoid errors.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WinAPI function GetFileInformationByHandle