.TH OPENNET 3 "25 Nov 04" "@PACKAGE_STRING@" .SH NAME opennet \- URL handling library. .SH SYNOPSIS .B #include .sp .BI "int open_net(const char *" pathname ", int " flags ", mode_t " mode ");" .br .BI "off_t lseek_net(int " filedes ", off_t " offset ", int " whence ");" .br .BI "ssize_t read_net(int " fd ", void *" buf ", size_t " count ");" .br .BI "NETFILE *fopen_net(const char *" path ", const char *" mode ");" .br .BI "int fseek_net(NETFILE *" stream ", long " offset ", int " whence ");" .br .BI "int fgets_net(char *" s ", int " size ", NETFILE *" stream ");" .br .BI "int fread_net(void *" ptr ", size_t " size ", size_t " nmemb ", NETFILE *" stream ");" .SH DESCRIPTION Opennet 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. .SH EXAMPLE .nf #include #include #include #include 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: Error\n"); return(EXIT_FAILURE); } fg_ret = fgets_net(buf, sizeof(buf) - 1, fp); if (fg_ret == NULL) { fprintf(stder, "fgets: Error\n"); return(EXIT_FAILURE); } printf("read: %s", buf); return(EXIT_SUCCESS); } .fi .SH "SEE ALSO" .BR fopen_net (3), .BR fseek_net (3), .BR lseek_net (3), .BR open_net (3), .BR read_net (3)