create hsmc repo
This commit is contained in:
commit
0506ec019b
26 files changed
+5413
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#ifndef __autofile_h__
|
||||
#define __autofile_h__
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
class AutoFILE
|
||||
{
|
||||
public:
|
||||
AutoFILE(char* filename, char* mode = "r")
|
||||
{
|
||||
f = fopen(filename,mode);
|
||||
}
|
||||
~AutoFILE()
|
||||
{
|
||||
if ( Opened() )
|
||||
fclose(f);
|
||||
}
|
||||
operator FILE* ()
|
||||
{
|
||||
return f;
|
||||
}
|
||||
bool Opened()
|
||||
{
|
||||
return f != (FILE*)0;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE* f;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // __autofile_h__
|
||||
|
||||
Reference in new issue
Block a user