36 #include "lib/charbuf.h" 43 #if defined(UNIX
) || defined(HAIKU) 49 #if defined(UNIX
) || defined(HAIKU) 52 if (path ==
nullptr) {
78 while ((entry = readdir(dir)) !=
nullptr) {
94 type = TXTLISTDIRTUNKNOWN;
96 switch (entry->d_type) {
108 const unsigned short colsize = 12;
110 unsigned int b = colsize - a;
123 CharBuffer* lines =
new CharBuffer();
133 #if !defined(WINDOWS) 134 file = fopen(name,
"r");
136 fopen_s(&file, name,
"r");
176 #if !defined(WINDOWS) 177 file = fopen(name,
"w");
179 fopen_s(&file, name,
"w");
187 char* i =
const_cast<
char*>(text);
189 while (r != EOF && *i)
191 r = fputc(*i++, file);
void Append(const char c)
CharBuffer * LoadTextFile(const char *name)
CharBuffer * ListDirectory(const char *path)
bool SaveTextFile(const char *name, const char *text)
void Append(const char *source)
static const int blocksize
CharBuffer()
Initialize without allocating memory.
bool StrIsEqual(const char *s1, const char *s2)
Compare two null terminated strings to each other.
void EnsureGrowth(unsigned int size)
int StrLen(const char *string)
Get the length of a null terminated string.
void EnsureSize(unsigned int blocksize, unsigned int blocks)
void Append(const char c, unsigned int count)
Encapsulate an character array which can be used as a string.
void EnsureSize(unsigned int size)
Ensure a memory block of specified size is allocated.
#define TXTLISTDIRTUNKNOWN