Hugh McMaster hugh.mcmaster@outlook.com writes:
p = strpbrkW(line, line_endings);
if (!p)
{
HeapFree(GetProcessHeap(), 0, buf);
return NULL;
If there are no line endings you need to read more data instead of failing. Also it looks to me that you are reading the entire file into the buffer instead of just one line.