i can like do stuff wit file using
std::ofstream filenamehere(dirgoeshere)
but is there ne need to close a file opened for memory and sharing
and how wud i if needed
Printable View
i can like do stuff wit file using
std::ofstream filenamehere(dirgoeshere)
but is there ne need to close a file opened for memory and sharing
and how wud i if needed
filenamehere.close();
It always pays to be tidy. For example, some OS's are "supposed" to delete an allocated memory that isn't deleted at the end of a program. But, would you rather take the risk or add the extra line of code.
I think fstream's close() member is called anyway in the destructor, but I may be wrong.
It probably does, since I forgot to call close one time, and I still was able to open it, and if you don't close a file, windows barfs up some access denied errors.
thanks u guys(and gals if ne lol)