All pastes #259119 Raw Edit

Something

public text v1 · immutable
#259119 ·published 2006-11-27 03:01 UTC
rendered paste body
#define BUFF_SIZE 20
#define READ_SIZE 15

char            *get_next_line(const int fd)
{
  static char   buff_read[BUFF_SIZE];
  static int    repeat;
  int           i;

  if (BUFF_SIZE < READ_SIZE)
    return ("BUFF SIZE cannot be shorter than READ SIZE.");
  i = 0;
  repeat = read(fd, buff_read, READ_SIZE);
  while (buff_read[i] != '\n' && buff_read[i] != '\0' && BUFF_SIZE >= i && READ_SIZE >= i)
    {
      my_putchar(buff_read[i]);
      i++;
    }
  i = 0;
  free (buff_read);
  return (0);
}

int     main()
{
  get_next_line(0);
  get_next_line(0);
}