libssh2_sftp_seek(3)
π libssh2_sftp_seek β setting the read/write position indicator within a file π
okay bestie, come sit with me, we're talking about libssh2_sftp_seek from the libssh2 manual, section 3. it's giving β¨file pointer energyβ¨ and honestly? it's a whole mood.
β¨ SYNOPSIS β¨
#include <libssh2.h>
#include <libssh2_sftp.h>
void
libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle,
size_t offset);
like yes, two includes, one function, zero drama (except the deprecation, we'll get there π«£).
π¦ DESCRIPTION π¦
π¨ Deprecated function. Uselibssh2_sftp_seek64(3)instead! not me telling you the sequel is better, but the sequel IS better. this one is the legacy queen and we respect her, but fr fr go uselibssh2_sftp_seek64(3). π
now the deets:
handleβ an SFTP File Handle, exactly the kind you get handed back bylibssh2_sftp_open_ex(3). it's your little ticket to the file, keep it safe πoffsetβ how many bytes from the beginning of the file you wanna seek to. literally just a byte count from the start. that's it, that's the number πΈ
so what does it actually DO? it moves the file handle's internal pointer to an arbitrary location. any spot you want in the file, it'll park the pointer there. main character chooses her own location, periodt. π
but here's the tea β β and this part is important, so don't skim it:
libssh2 implements file pointers as a localized concept. that means it's keeping that pointer right here, on your side, purely so that file access appears more POSIX like. it's cosplay. it's aesthetic. it's for your convenience. π§
no packets are exchanged with the server during a seek operation. none. zero. the server literally does not hear about it. π
and that localized file pointer? it gets used as a convenience offset during read/write operations. so it's not doing nothing β it's just doing it locally, and it matters when you go to read or write. π
π SEE ALSO π
(go read libssh2_sftp_seek64(3), she's the one you actually want. iykyk π)
π a lil sign-off π
this page is brought to you by libssh2 1.0, dated 22 Dec 2008 β a vintage icon, an elder, a legend who was ahead of her time. she's been sitting here since 2008 serving localized file pointer realness and honestly? we stan. β
okay that's the whole page bestie, go forth and seek responsibly, and remember: deprecated means use the other one. bye!! π¦πβ¨
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms