*文件和文件之间的区别[fd]

时间:2019-05-31 17:48:44

标签: c

* files和files [fd]有什么区别,其中:

fd-描述符文件

文件-大量的静态字符; (静态char * files [MAX_FD];)

static int read_file(int fd, char **files, char **line, char 
*content)
{
char    *tmp;
int     bytes;

while ((bytes = read(fd, content, BUFF_SIZE)) > 0)
{
    if (files[fd] != NULL)
    {
        tmp = *files;
        *files = ft_strjoin(tmp, content);
        free(tmp);
        tmp = NULL;
    }
    else
        *files = ft_strdup(content);
}

int get_next_line(int const fd, char **line)
{
    static char     *files[MAX_FD];
    bytes = read_file(fd, &files[fd], line, content);
}

0 个答案:

没有答案