36 const TCHAR * start = str;
56 while (*str1 && *str1 == *str2)
97 return (chr ==
TEXT(
' ') || chr ==
TEXT(
'\t') ||
98 chr ==
TEXT(
'\r') || chr ==
TEXT(
'\n'));
116 *dest_ptr = (
TCHAR *)malloc((num_chars + 1) *
sizeof(
TCHAR));
121 memcpy(*dest_ptr, src, num_chars *
sizeof(
TCHAR));
122 (*dest_ptr)[num_chars] = 0;
159 m_fgets(FILE* file,
TCHAR * buffer,
size_t buffer_size,
size_t * out_size_ptr)
163 if (!file || !buffer || !buffer_size || !out_size_ptr)
165 LOG_ERROR(
"Invalid args supplied to m_fgets");
173 while (pos < buffer_size - 1)
175 if (!fread(&c,
sizeof(
TCHAR), 1, file))
181 if (c ==
TEXT(
'\r') || c ==
TEXT(
'\n'))
185 if ((readed = fread(&c1,
sizeof(
TCHAR), 1, file)) &&
186 (c1 ==
TEXT(
'\r') || c1 ==
TEXT(
'\n')) && c1 != c)
194 fseek(file, -1l, SEEK_CUR);
203 return pos ? buffer :
NULL;
219 fwrite(buffer,
sizeof(
TCHAR), len, file);
234 char * buf = (
char *)buffer;
235 size_t len = strlen(buffer) *
sizeof(
TCHAR);
238 buf = (
char*)malloc(len);
239 while (*buffer) *buf++ = *buffer++, *buf++ = 0;
241 fwrite(buf,
sizeof(
TCHAR), len, file);
260 #if defined (UNICODE)