PCAP_DUMP_FTELL(3PCAP)
β¨ PCAP_DUMP_FTELL π
okay bestie, welcome to the libpcap manual page for pcap_dump_ftell and pcap_dump_ftell64 β the two functions that tell you where you're at in a savefile you're currently writing. yes, we're doing file offsets today and it's gonna be iconic π
πΈ NAME πΈ
pcap_dump_ftell, pcap_dump_ftell64 β get the current file offset for a savefile being written β¨
like, "how many bytes in are we rn" but for the file you're writing to instead of reading from. periodt.
π¦ SYNOPSIS π¦
#include <pcap/pcap.h>
long pcap_dump_ftell(pcap_dumper_t *p);
int64_t pcap_dump_ftell64(pcap_dumper_t *p);
literally just these two, both taking a pcap_dumper_t *p and both handing you back an offset. one's the little version and one's the big version, iykyk π
π DESCRIPTION π
π pcap_dump_ftell()
so pcap_dump_ftell() returns the current file position for the savefile β and that's literally the number of bytes written by pcap_dump_open(3PCAP) and pcap_dump(3PCAP). that's it, that's the whole vibe π«Ά
on error it returns PCAP_ERROR. and here's the part you need to know, bestie, because it's giving β οΈ: if the current file position does not fit in a long, it will be truncated. no cap. this can happen on 32-bit UNIX-like systems with large file support and on Windows π so likeβ¦ big file, small long, sad girl hours.
π§ pcap_dump_ftell64()
pcap_dump_ftell64() returns the current file position in an int64_t instead. so if file offsets that don't fit in a long but do fit in an int64_t are supported, this baby will return the file offset without truncation π₯ slay. she ate and left no crumbs.
and yep β PCAP_ERROR is returned on error here too. same energy, bigger container π
so the whole tea is:pcap_dump_ftell()=long, maybe truncated;pcap_dump_ftell64()=int64_t, not truncated (when the platform supports offsets that big). both sayPCAP_ERRORwhen things go wrong. choose accordingly π
π 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. π like, none. zero. the long was the whole world and the world had edges. so if you're targeting something ancient, keep that in mind, bestie π
π SEE ALSO π
pcap(3PCAP)
go read the big one, it's the main character of this whole family π
πΈβ¨ and that's the page, bestie! brought to you by PCAP_DUMP_FTELL(3PCAP), dated 25 July 2018 β mwah, love u, go write some packets πππ¦
π¦ where this page comes from
- alpine 3.22: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.23: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.24: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- centos-stream 10: libpcap-devel 14:1.10.4-8.el10 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- centos-stream 9: libpcap-devel 14:1.10.0-5.el9 Β· BSD with advertising
- centos-stream 9: libpcap-devel 14:1.10.0-5.el9 Β· BSD with advertising
- debian bookworm: libpcap0.8-dev 1.10.3-1
- debian trixie: libpcap0.8-dev 1.10.5-2
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- nixos 26.05: libpcap 1.10.7
- nixpkgs unstable: libpcap 146
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- ubuntu jammy: libpcap0.8-dev 1.10.1-4build1
- ubuntu jammy: libpcap0.8-dev 1.10.1-4ubuntu1.22.04.2
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3.1
- ubuntu questing: libpcap0.8-dev 1.10.5-2ubuntu2
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1 Β· BSD-3-clause-var3
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1.1 Β· BSD-3-clause-var3
- ubuntu stonking: libpcap0.8-dev 1.10.7-1ubuntu1 Β· BSD-3-clause-var3
- 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