Skip to content
Snippets Groups Projects
main.c 86.4 KiB
Newer Older
  • Learn to ignore specific revisions
  •    do
       {
          if (NULL == fgets(buf, sizeof(buf), fp))
             break;
          if (NULL == retval)
             retval = strdup(buf);
          else
          {
             if (NULL == (retval = realloc(retval,
                                           strlen(retval) + strlen(buf) + 1)))
                break;
             strcat(retval, buf);
          }
       }
       while (NULL == (nl = strchr(retval, '\n')));
    
       if (NULL != nl)
         *nl = '\0';
    
       return retval;
    }