title: Wrap long lines from a file for output in console window in c program
body: <p>Here is my code but it is not making any output to console window. I need to print from output file and also wrap the lines for a particular number of characters, say, 20 character per line:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define SIZE 100
  
  int
  main (int argc, char *argv[])
  {
    FILE *fp = NULL;
    char line[SIZE] = { 0 };
    int i = 0;
  
    for (i = 0; i &lt; argc; i++)
      {
        printf ("The argc %d is %s\n", i, argv[i]);
      }
  
    fp = fopen (argv[1], "r");
    if (fp == NULL)
      {
        printf ("Can't open input file\n");
      }
    else
      {
        while (!feof (fp))
          {
            if (fgets (line, sizeof line, fp))
              {
                printf ("%s", line);
              }
          }
      }
  
    if (fclose (fp) != 0)
      {
        printf ("Error closing file\n");
      }
  
    return 0;
  }
  </code></pre>