#ifndef NXS_FILE_H #define NXS_FILE_H //TODO move includes in cpp #ifdef WIN32 #include #else #include #endif #include #include namespace nxs { class File { public: File(): fp(NULL) {} ~File() { Close(); } bool Create(const std::string &filename); bool Load(const std::string &filename, bool readonly = false); void Close(); unsigned int Length() { return size; } void Redim(unsigned int elem); void SetPosition(unsigned int chunk); void ReadBuffer(void *data, unsigned int size); void WriteBuffer(void *data, unsigned int size); bool IsReadOnly() { return readonly; } protected: #ifdef WIN32 HANDLE fp; #else FILE *fp; #endif unsigned int size; bool readonly; }; } #endif