Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 538 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 538 Bytes

cfetch

Simple fetch function using libcurl

Example

#include "cfetch.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv) {

    size_t len;
    char *buffer = cfetch(argv[1], &len);
    char *outfile = argv[2];

    /* memory error */
    if(buffer == NULL)
        return 1;

    FILE *f = fopen(outfile, "wb");

    fwrite(buffer, 1, len, f);
    fclose(f);

}

Usage

$make
$./main https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf teste.pdf