Hi,
I'm just reading up on resource management and RAII (Resource Acquisition Is Initialisation) and it got me thinking regarding files.
If say I have a program that uses different file names. Would it be a good idea to create a file_handle class that simply takes a file name as an argument and the file is opened in the constructor and closed in the destructor?
I can then use objects of this type either as member objects of other classes or within functions, that way when the objects go out of scope the file is released. Would this be something that works in real world code?
Thanks.