vector<queuedFile> ReadConfiguration(wstring const& filename) { vector<queuedFile> retv; // Read each line // if the line begins with a ';' discard it // strip out the whitespace at the beginning FileHandle hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) { return retv; } // We will assume the config file is less than 4GB long. If you have one that big, the error is yours string buffer; buffer.resize(GetFileSize(hFile, NULL) + 1); buffer[buffer.size()-1] = 0; DWORD readLen = 0; ReadFile(hFile, &buffer[0], buffer.size()-1, &readLen, NULL); vector<string> validLines = ConvertBufferToLines(buffer); return ProcessConfig(validLines); }