title: C Caesar Cipher Function Call Not Behaving as Expected
body: <p>I am trying to build a program that will do a simple caesar cipher on a text file with single strings with no spaces on each line. For some reason, my cipher function is not shifting text and I am cutting off the strings at various lengths of characters. Can you see where I am messing up with my function call in the while loop?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define FILE_NAME "./infile.txt"
  
  void caeser (char * ch, int shift)
  {
      int i = 0;
      int len = strlen(ch);
  
      while (ch[i] &lt; len)
      {
          if (islower(ch[i]))
              ch[i] = ((ch[i] - 'a' + shift) % 26 + 'a');
          else
              ch[i] = ((ch[i] - 'A' + shift) % 26 + 'A');
      }i++;
  
      printf("Caesar Cipher = %s\n", ch);
  
  }
  
  int main(void)
  {
      char *  c = malloc( sizeof(char) * 1000);
  
  
      FILE* fp = fopen (FILE_NAME, "r");
      if (fp == NULL)
      {
          printf("Can't open %s\n", FILE_NAME);
          exit(EXIT_FAILURE);
      }
  
      while(fgets(c, sizeof(c), fp) != 0)
      {
          printf("%s\n", c);
          caeser(c, 1);
      }
  
      fclose(fp);
      fp = NULL;
      return 0;
  }
  </code></pre>