
2 Nov
2007
2 Nov
'07
10:11 p.m.
//will crash if fread returns 0 shared_ptr<FILE> foo(fread("foo.txt","r"),fclose);
I don't think shared_ptr is designed to work on things like a FILE*. One uses filestream or writes a simple class wrapping up the FILE*.
In fact the ability to wrap handles such as FILE directly is one of the great features of shared_ptr. Why would I write a simple class wrapping up the FILE * if shared_ptr<FILE> works just as well? -- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode