1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add file wrappers.

This commit is contained in:
Bartosz Taudul
2017-09-30 16:19:50 +02:00
parent e2cd3106ae
commit 2021b7460a
4 changed files with 80 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef __TRACYFILEWRITE_HPP__
#define __TRACYFILEWRITE_HPP__
#include <stdio.h>
namespace tracy
{
class FileWrite
{
public:
static FileWrite* Open( const char* fn )
{
auto f = fopen( fn, "wb" );
return f ? new FileWrite( f ) : nullptr;
}
~FileWrite()
{
fclose( m_file );
}
void Write( const void* ptr, size_t size )
{
fwrite( ptr, 1, size, m_file );
}
private:
FileWrite( FILE* f ) : m_file( f ) {}
FILE* m_file;
};
}
#endif