GOLF(2gg)
π GOLF(2gg) β the file-position glow-up β¨
okay bestie so this is a page from the GOLF(2gg) manual, in the Development section, and it's about file-position. it's giving "let's find out where we are in a file, or yeet ourselves to a new spot" energy. no cap. π
β¨ NAME β¨
file-position β (files) ποΈ
π― PURPOSE π―
set a position, or get the current position, for a file that's already open. that's it, that's the whole vibe. π
π SYNTAX π
file-position file-id <file id> \
( set <position> ) | ( get <position> ) \
[ status <status> ]
πΈ DESCRIPTION πΈ
file-position will set or get the position for a file that you opened with open-file, where <file id> is an open file identifier. π«Ά
- if the
"set"clause is used, the file position gets set to<position>(and yes,0is the first byte, we start counting at zero like the little gremlins we are π) - if the
"get"clause is used, the file position gets obtained into<position>(again,0is the first byte π)
the <status> number in the "status" clause will be GG_OKAY if the set/get succeeded, GG_ERR_OPEN if the file isn't open, or GG_ERR_POSITION if not. lowkey a whole mood board of outcomes. π
β οΈ okay important one, bestie: setting the position past the last byte of the file is okay for writing β in this case the bytes between the end of file and the <position> are filled with null-bytes when the write operation occurs. so like, it works, but the gap is just a lil void of null-bytes. π
π« EXAMPLES π«
open the file "testwrite", set the file byte position to 100, then obtain it later:
open-file "testwrite" file-id nf
file-position file-id nf set 100
...
file-position file-id nf get pos
See also open-file. π¦
π SEE ALSO π
Files πΈ
change-mode close-file copy-file delete-file file-position file-storage file-uploading lock-file open-file read-file read-line rename-file stat-file temporary-file uniq-file unlock-file write-file β See all documentation π₯
and that's the whole page, periodt. π
this one's from $DATE, version $VERSION, out of the GOLF(2gg) manual β tysm for reading, ily, go set some file positions responsibly πβ¨π
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms