46b2ed80ae
Another nuke! This time, trying to do a client <-> server thing. Also a bit of messing with Lua.
44 lines
748 B
C++
44 lines
748 B
C++
#pragma once
|
|
|
|
#ifndef _FILE_OFFSET_BITS
|
|
#define _FILE_OFFSET_BITS 64 /* off_t */
|
|
#endif
|
|
|
|
#ifndef _POSIX_C_SOURCE
|
|
#define _POSIX_C_SOURCE 200112L
|
|
#endif
|
|
|
|
#include <ctime>
|
|
#include <string>
|
|
|
|
class FileIO
|
|
{
|
|
FILE* fp;
|
|
std::string path;
|
|
public:
|
|
~FileIO (void)
|
|
{
|
|
if (fp)
|
|
{
|
|
Close ();
|
|
fp = NULL;
|
|
}
|
|
}
|
|
FileIO (const std::string&, const std::string&);
|
|
FileIO (FILE* f)
|
|
{
|
|
fp = f;
|
|
}
|
|
FILE* Open (const std::string&, const std::string&);
|
|
int Close (void);
|
|
int Seek (const off_t, const int);
|
|
off_t Tell (void);
|
|
size_t Read(void*, const size_t);
|
|
size_t Write (const void*, const size_t);
|
|
void Rewind (void);
|
|
/* I added these. */
|
|
time_t Mtime (void);
|
|
off_t Size (void);
|
|
std::string ReadToString (void);
|
|
};
|