read_scf(3)

πŸ“¦
version 1.15.1 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ read_scf β€” the SCF reading girlies ✨

okay so bestie, welcome to the read_scf(3) page from the Staden Package πŸ’– this is your little group chat for pulling SCF format trace files into memory, and honestly? iconic behaviour. three functions, one mission: get that trace data out of the file and into your structs. let's go πŸ¦‹


πŸ’« NAME πŸ’«

read_scf, fread_scf, read_scf_header β€” the trio that reads SCF files, no cap πŸ“–βœ¨


🌸 SYNOPSIS 🌸

#include <scf.h>

Scf *read_scf(
     char *fn);

Scf *fread_scf(
     FILE *fp);

int read_scf_header(
     FILE *fp,
     Header *h);

πŸŽ€ DESCRIPTION πŸŽ€

So these functions read SCF format trace files. That's the vibe. πŸ’…

Big important heads-up though: every single one of these that takes a FILE * as an argument assumes the file pointer is already sitting at the correct offset within the file. They will not hunt around for it for you. You gotta position it yourself first, bestie. That's on you 🫢

  • read_scf() β€” reads a whole entire SCF file into the Scf structure. Want the deets on that structure? Go look at the scf(4) manual page, she explains everything πŸ‘‘ The data gets read from the file name you specified.
  • fread_scf() β€” also reads a whole entire SCF file into the Scf structure (again, scf(4) for the structure details, same deal πŸ’–). But this one reads from the file pointer you hand it. And listen β€” that file pointer is neither closed nor rewound after the operation. She does not touch it. She leaves it exactly where it is. Respect 🧚
  • read_scf_header() β€” just reads the Header structure from the file pointer you give her. That's it, that's the whole job. Little snack, lowkey 🌈

⭐ RETURN VALUES ⭐

  • On successful completion, read_scf() and fread_scf() return a pointer to a Scf structure. πŸŽ‰
  • If things don't go well, those two return a null pointer. sobs 😭 check for it, fr fr.
  • On successful completion, read_scf_header() returns 0. πŸ₯³
  • Otherwise, read_scf_header() returns -1. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


real talk: the FILE * offset thing is not a suggestion, it's a requirement. if your pointer is in the wrong place you're getting wrong data and nobody's gonna warn you πŸ™ˆ position responsibly.

okay that's the whole page, you ate it, you understood it, periodt πŸ’…βœ¨ this has been the read_scf(3) page out of the Staden Package β€” go forth and read those trace files, main character πŸŒΈπŸ¦‹πŸ’œ

πŸ“¦ where this page comes from