title: Include static data/text file
body: <p>I have a text file (>50k lines) of ascii numbers, with string identifiers, that can be thought of as a collection of data vectors. Based on user input, the application only needs one of these data vectors at runtime.</p>
  
  <p>As far as I can see, I have 3 options for getting the information from this text file:</p>
  
  <ol>
  <li>Keep it as a text file, extract the required vector at run-time. I believe the downside is that you can't have a relative path in the code, so the user would have to point to the file's correct location (?). Or alternatively, get the configure script to inject the absolute path as a macro. </li>
  <li>Convert it to a static unsigned char using <a href="http://www.linuxmanpages.com/man1/xxd.1.php" rel="nofollow noreferrer" title="xxd">xxd</a> (as explained <a href="https://stackoverflow.com/a/6240362/758811">here</a>) and then include the resulting file. Downside is that a 5MB file turns into a 25MB include file. Am I correct in thinking that this 25MB is loaded into memory for the duration of the runtime? </li>
  <li>Convert it to an object and link using <a href="http://linux.die.net/man/1/objcopy" rel="nofollow noreferrer">objcopy</a> as explained <a href="http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967" rel="nofollow noreferrer">here</a>. This seems to keep the file size about the same -- are there other trade-offs?</li>
  </ol>
  
  <p>Is there a standard/recommended method for doing this? I can use C or C++ if that makes a difference.</p>
  
  <p>Thanks.</p>
  
  <p>(Running on linux with gcc)</p>