title: Embedding text file in c++ code
body: <p>I have the following text file:
  g.dat</p>
  
  <pre><code>16
  0.0950125098376374401853193354250
  0.281603550779258913230460501460
  0.458016777657227386342419442983
  0.617876244402643748446671764049
  0.755404408355003033895101194847
  0.865631202387831743880467897713
  0.944575023073232576077988415535
  0.989400934991649932596154173450
  
  0.189450610455068496285396723209
  0.182603415044923588866763667977
  0.169156519395002538189312079058
  0.149595988816576732081501730116
  0.124628971255533872052476277863
  0.0951585116824927848099251053810
  0.0622535239386478928628438391746
  0.0271524594117540948517805723700
  </code></pre>
  
  <p>And the following C++ code to ready it:</p>
  
  <pre><code>ifstream In;
    In.open(("g.dat").c_str());
    In&gt;&gt;gaussdim;
    gt = new double[gaussdim];
    gc = new double[gaussdim];
    for(int i=0;i&lt;gaussdim/2;i++)
    {
      In&gt;&gt;gt[i];
      gt[gaussdim-i-1]=-gt[i];
    }
    for(int i=0;i&lt;gaussdim/2;i++)
    {
      In&gt;&gt;gc[i];
      gc[gaussdim-i-1]=gc[i];
    }
    In.close();
  </code></pre>
  
  <p>I would like to embed this data file into my program so that I can easily redistribute it and not be dependent on always taking care of many different files. I am targeting linux and mac so xxd would be a possibility for me to convert the data to a big char. I would need help with the next step, i.e. how to convert this char into a stream or whatever better solution there is. What do you recommend?    </p>
  
  <p>Edit: a lot of good answers, the chosen one has for me the advantage that the change to the code is minimal and is general enough that I can use it in other similar parts of the code where several input files with different structure are parsed.</p>