|
NAMEinitfdpos , initFILEpos ,
adjfdpos , adjFILEpos —
file positions indicator handling
SYNOPSIS#include <stdio.h>
#include <strfunc.h>
int
int
int
DESCRIPTIONThose functions are used to maintain a file positions indicator between the program sessions. This is often needed when a process is being parsed a log file and tries to save current position within this log to start from this point later.int
int Both functions returns position file descriptor, or -1 in case of failure. int
Return values: 0 (Success) or -1 in case of any errors. EXAMPLEvoid main() { int posfd; FILE *logfile; char buf[1042]; logfile = fopen("file.log", "r"); if(!logfile) exit(EX_NOINPUT); while(fgets(buf, sizeof(buf), logfile)) { /* Do something ... */ adjFILEpos(logfile, posfd, 0); }; /* Force data to be flushed on disk. */ adjFILEpos(logfile, posfd, 1); fclose(logfile); close(posfd); }; SEE ALSOstrfunc(3).AUTHORSLev Walkin <vlm@lionet.info>
Visit the GSP FreeBSD Man Page Interface. |