J,aimerais que ce code m'affiche la ligne lue SANS sauter de ligne a la fin, pouvez vous regarder le code pour modifier mon prob

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
#include <fcntl.h>
#include <unistd.h>
#include <utmpx.h>
#include "get_next_line.h"
#define SIZE_BUFFER 1
 
int     *malloc(int size);
 
char            *get_next_line(int fd)
{
  char          *result;
  char          *temp;
  static int    size;
  static char   buffer;
  static int    i;
 
  size = 0;
  result = malloc(*result);
  while ((i = read(fd, &buffer, SIZE_BUFFER) == 1) && (buffer != '\n'))
    {
      if (((size + 1) % SIZE_BUFFER) == 0)
        {
          temp = malloc(size + 1);
          strcpy(temp, result);
          free(result);
          result = temp;
        }
      size++[result] = buffer;
      size[result] = 0;
    }
  if (i =! 0)
    puts (result);
  free(result);
  return (0);
}
 
int     main()
{
  int   fd;
 
  fd = open("test", O_RDONLY);
  get_next_line(fd);
  return (0);
}