title: Printing string with %s prints wrong data
body: <p>I'm reading from file to string with fread function and then printing the string.
  I defined the string as array of chars with LONGNUM size(pre defined value).
  I'm reading 1 element 1 byte size each time.
  when printing the string with : printf("the string that read is: %s\n",buffer);
  the output is : the string that read is b
  I don't get it, why in the end of the stringi get this  values?
  when printing the string with : printf("the string that read is : %c\n",buffer[0]);
  I get the write output without  values.
  please explain me why.</p>
  
  <p>the code is </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define LONGNUM 1
  
  void main(int argc,char *argv[])
  {
  
      FILE * src;
      FILE * dst;
      int num;
      char buffer[LONGNUM];
  
      // argc is the number of the elements in argv
      // the first argv element is the name of the program
  
      if(argc &lt; 3){
          printf("prototype error &lt;source path&gt; &lt;dest path&gt;\n");
          return;
      }
      printf ("source  path is : %s \n",argv[1]);
      printf ("dest path is : %s \n",argv[2]);
  
      src = fopen(argv[1],"r");
  
      while(!(feof(src))){
          num = fread(buffer,1,1,src);
          printf("the number of items read %d\n",num);
          printf("the string that read is %s\n",buffer);
          //printf("the string that read is %c\n",buffer[0]);
  
      }
  
  }
  </code></pre>
  
  <p>I would like you to advise me what is the write way to do it.
  Thanks.</p>