static void steamReadFromFile(uv_work_t *req) { FileIOAsync *readData = (FileIOAsync*)req->data; ISteamRemoteStorage *pSteamRemoteStorage = SteamRemoteStorage(); // Check if file exists if (!pSteamRemoteStorage->FileExists(readData->sFilename.c_str())) { readData->bSuccess = false; readData->sError = "File doesn't exist"; return; } int32 nFileSize = pSteamRemoteStorage->GetFileSize(readData->sFilename.c_str()); char *sFileContents = new char[nFileSize+1]; int32 cubRead = pSteamRemoteStorage->FileRead( readData->sFilename.c_str(), sFileContents, nFileSize ); sFileContents[cubRead] = 0; // null-terminate if (cubRead == 0 && nFileSize > 0) { readData->bSuccess = false; readData->sError = "Error loading file"; } else { readData->bSuccess = true; readData->sContent = sFileContents; } delete sFileContents; return; }