PCAP_DUMP_FTELL(3)
okay bestie, welcome to the PCAP_DUMP_FTELL(3) page from the Library Functions Manual β itβs the one about checking the current file offset of a savefile while youβre writing it. short, sweet, and lowkey essential π
β¨ NAME β¨
pcap_dump_ftell, pcap_dump_ftell64 β get the current file offset for a savefile being written. periodt.
πΈ SYNOPSIS πΈ
#include <pcap/pcap.h>
long pcap_dump_ftell(pcap_dumper_t *p);
int64_t pcap_dump_ftell64(pcap_dumper_t *p);
no cap, thatβs the whole include-and-call situation π
π DESCRIPTION π
okay so pcap_dump_ftell() returns the current file position for the savefile β the number of bytes written by pcap_dump_open(3) and pcap_dump(3). itβs giving βwhere are we rnβ energy for your output file β¨.
if something goes wrong, PCAP_ERROR is returned. and hereβs the part to pay attention to: if the current file position does not fit in a long, it will be truncated. this can happen on 32-bit UNIX-like systems with large file support and on Windows. not me warning you about a sneaky little truncation π.
then we have pcap_dump_ftell64(): it returns the current file position in an int64_t, so if file offsets that donβt fit in a long but that fit in an int64_t are supported, this will return the file offset without truncation. iconic. and yes, PCAP_ERROR is returned on error here too π
.
π¦ BACKWARD COMPATIBILITY π¦
the function pcap_dump_ftell64() became available in libpcap release 1.9.0. in previous releases, there was no mechanism to obtain a file offset that is too large to fit in a long. so if youβre on an older release and need that big-offset lifestyle, bestieβ¦ thatβs just not a thing there π«Ά.
π SEE ALSO π
pcap(3)β go read it for the full libpcap vibe π
signed with love by the PCAP_DUMP_FTELL(3) girlies on 25 July 2018, straight outta the Library Functions Manual π
β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms