title: Piping output of C program to file (bash)
body: <p>I'm just trying my hand in bash, so I wrote a simple program in C to count the number of characters in a file.</p>
  
  <p>This is my C program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
    int i, nc;
    nc = 0;
    i = getchar();
    while (i!=EOF){
      nc = nc + 1;
      i = getchar();
    }
    printf("%d\n",nc);
  
    return 0;
  }
  </code></pre>
  
  <p>This is the bash command I'm using to compile and execute:</p>
  
  <pre><code>gcc sign.c &lt; bright_side_of_life &gt; output
  </code></pre>
  
  <p>My output file is completely empty though. Where am I going wrong?</p>