fstream---------> wats "close" and "open "making so many problems

C++:
HI,I have searched many websites to get info abt... y everytime file unlocked automatically once same file is opened after.

I locked a file.and sarted opening that file,and i didnt cose that file.Even thought that file is automatically unlocking.

The reason is:
If you open an ofstream object with a file name, and write output to it, then call open() on the same file stream/same file without closing it, there will be no errors. The call to open() will close the file you were writing to and just open same/another file.

And one more thing even if u locked a file in write mode,and trying to read only mode and close that file stream makes the same file to be unlocked automatically.take care these things when u r doing locking problems.

Core will be generated as file discriptor value reached 255 value(we can change this vaue !),"close" statements are missed means everytime only "open" statements will be counted and file discriptor will get added in value and reach to thrishold value and gives error.
To find how many open/close atateemtns while executing a programme .....

No comments :

Post a Comment