title: Reading from a very large text file resource in C++
body: <p>We have some data in a text file which is built into our executable as a custom resource to be read at runtime. The size of this text file is over 7 million characters. </p>
  
  <p>I can successfully search for and locate strings within the resource which appear near the top of the text file, but when attempting to search for terms a few million characters down, strstr returns NULL indicating that the string cannot be found. Is there a limit to the length of a string literal that can be stored in a char* or the amount of data that can be stored in an embedded resource? Code is shown below</p>
  
  <pre><code>char* data = NULL;
  HINSTANCE hInst = NULL;
  HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_TEXT_FILE1), "TESTRESOURCE");
  if(NULL != hRes)
  {
      HGLOBAL hData = LoadResource(hInst, hRes);
      if (hData)
      {
          DWORD dataSize = SizeofResource(hInst, hRes);
          data = (char*)LockResource(hData);
      }
      else
          break;
  
      char* pkcSearchResult = strstr(data, "NumListDetails");
      if ( pkcSearchResult != NULL )
      {
          // parse data
      }
  }
  </code></pre>
  
  <p>Thanks.</p>