title: "#include" a text file in a C program as a char[]
body: <p>Is there a way to include an entire text file as a string in a C program at compile-time?</p>
  
  <p>something like:</p>
  
  <ul>
  <li><p>file.txt:</p>
  
  <pre><code>This is
  a little
  text file
  </code></pre></li>
  <li><p>main.c:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void) {
     #blackmagicinclude("file.txt", content)
     /*
     equiv: char[] content = "This is\na little\ntext file";
     */
     printf("%s", content);
  }
  </code></pre></li>
  </ul>
  
  <p>obtaining a little program that prints on stdout "This is
  a little
  text file"</p>
  
  <p>At the moment I used an hackish python script, but it's butt-ugly and limited to only one variable name, can you tell me another way to do it?</p>