QIO(3)
π NAME π
okay so bestie, welcome to the QIO(3) Library Functions Manual page for qio β the quick I/O part of the InterNetNews library. it's giving fast little file-reading bestie energy π
β¨
β¨ SYNOPSIS β¨
#include "qio.h"
QIOSTATE *
QIOopen(name, size)
char *name;
int size;
QIOSTATE *
QIOfdopen(fd, size)
int fd;
int size;
void
QIOclose(qp)
QIOSTATE *qp;
char *
QIOread(qp)
QIOSTATE *qp;
int
QIOlength(qp)
QIOSTATE *qp;
int
QIOtoolong(qp)
QIOSTATE *qp;
int
QIOerror(qp)
QIOSTATE *qp;
int
QIOtell(qp)
QIOSTATE *qp;
int
QIOrewind(qp)
QIOSTATE *qp;
int
QIOfileno(qp)
QIOSTATE *qp;
πΈ DESCRIPTION πΈ
these routines are part of the InterNetNews library, libinn(3), and they're literally here to give you quick read access to files. the letters βQIOβ stand for Quick I/O. no cap, that's the whole vibe π¦
QIOopenβ opens the filenamefor reading. it uses a buffer ofsizebytes, which must also be larger than the longest expected line. the header file defines the constantQIO_BUFFERas a reasonable default. ifsizeis zero, thenQIOopenwill callstat(2)and use the returned block size; if that fails it will useQIO_BUFFER. it returnsNULLon error, or a pointer to a handle to be used in other calls. πQIOfdopenβ performs the same function except thatfdrefers to an already-open descriptor. iconic behavior honestly πQIOcloseβ closes the open file and releases any resources used by it. clean up your mess, bestie π§QIOreadβ returns a pointer to the next line in the file. the trailing newline will be replaced with a\0. if EOF is reached, an error occurs, or if the line is longer than the buffer,QIOreadreturnsNULL. πQIOlengthβ after a successful call toQIOread, this returns the length of the current line. slay πQIOtoolongandQIOerrorβ these can be called afterQIOreadreturnsNULLto determine if there was an error, or if the line was too long. ifQIOtoolongreturns non-zero, then the current line did not fit in the buffer, and the next call toQIOreadwill try to read the rest of the line. long lines can only be discarded. ifQIOerrorreturns non-zero, then a serious I/O error occurred. π«ΆQIOtellβ returns thelseek(2)offset at which the next line will start. πQIOrewindβ sets the read pointer back to the beginning of the file. rewind era πQIOfilenoβ returns the descriptor of the open file. π₯
β οΈ bestie, long lines can only be discarded β no rescuing them, okay?
QIOlength, QIOtoolong, QIOerror, QIOtell, and QIOfileno are implemented as macro's defined in the header file. yup, macro magic π
π EXAMPLE π
QIOSTATE *h;
long offset;
char *p;
h = QIOopen("/etc/motd", QIO_BUFFER);
for (offset = QIOtell(h); (p = QIOread(h)) != NULL; offset = QIOtell(h))
printf("At %ld, %s\n", offset, p);
if (QIOerror(h)) {
perror("Read error");
exit(1);
}
QIOclose(h);
π HISTORY π
written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. this is revision 1.7, dated 1993/01/29. historic icon behavior π
mwah π β source/version: QIO(3), revision 1.7, dated 1993/01/29. byeeee bestie, go read some files fast π«Άβ¨
π¦ where this page comes from
- debian bookworm: inn 1:1.7.2q-47
- debian trixie: inn 1:1.7.2q-52
- ubuntu jammy: inn 1:1.7.2q-46build3
- ubuntu noble: inn 1:1.7.2q-50
- ubuntu questing: inn 1:1.7.2q-52
- ubuntu resolute: inn 1:1.7.2q-52build1
- ubuntu stonking: inn 1:1.7.2q-52build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms