![]() |
![]()
| ![]() |
![]()
NAMEopennet - URL handling library. SYNOPSIS#include <opennet.h> int open_net(const char *pathname, int
flags, mode_t mode);
DESCRIPTIONOpennet is a library to provide an easy mechanism to open and handle URLs in the same way you would open and handle a regular file. EXAMPLE#include <opennet.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { NETFILE *fp = NULL; char *filename = NULL, *fg_ret = NULL; char buf[512] = {0}; filename = "http://www.rkeene.org/robots.txt"; fp = fopen_net(filename, "r"); if (fp == NULL) { fprintf(stder, "fopen: Error0); return(EXIT_FAILURE); } fg_ret = fgets_net(buf, sizeof(buf) - 1, fp); if (fg_ret == NULL) { fprintf(stder, "fgets: Error0); return(EXIT_FAILURE); } printf("read: %s", buf); return(EXIT_SUCCESS); } SEE ALSOfopen_net(3), fseek_net(3), lseek_net(3), open_net(3), read_net(3)
|