title: Add string to char array in C
body: <p>I have a C array called buf. Here is it's definition:</p>
  
  <p><code>char buf[1024];</code></p>
  
  <p>Now, my current code takes from <code>stdin</code> and uses <code>fgets()</code> to set that array, however I wish to use code to set it instead. Right now the line that sets buf looks like this:</p>
  
  <p><code>fgets(buf, 1024, stdin);</code></p>
  
  <p>Basically, I want to replace stdin, with say... "My String". What's the best way to do this?</p>