title: using the read() function to read a file
body: <p>I'm trying to read a file using the read() function, as following :</p>
  
  <pre><code>char buf[1024];
  int bytesRead;
  int fildes;
  char path[128];
  mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
  int flags = O_RDONLY;
  printf("\n--&gt;Donner l'emplacement du fichier :");
  scanf("%s", path)
  fildes = ouvrir(path, flags, mode);
  if(fildes == -1){
      printf("\nImpossible de lire le fichier. Réessayez plus tard. (%s)",strerror(errno));
  }else{
      do{
          bytesRead = read(fildes, buf, 1);
          printf("%s", buf);
      }while(bytesRead != 0);
  }
  </code></pre>
  
  <p>but I get the output as :</p>
  
  <pre><code>J�e� �m�'�a�p�p�e�l�e� �a�i�m�a�d�
  �j�'�a�i� �1�7� �a�n�s�
  � � �m�o�n� �e�m�a�i�l� �:� �s�p�o�o�n�a�t�t�e�@�g�m�a�i�l�.�c�o�m�
  �
  �
  </code></pre>
  
  <p>How can I solve that ?</p>