write_scf(3)

✨ write_scf β€” the SCF-writing besties ✨

okay so first things first: this is a page from section 3 of the Staden Package manual, and it's all about the trio of functions that write SCF files πŸ’– (their names are write_scf, fwrite_scf, and write_scf_header, if you were wondering, which you were).


πŸŽ€ NAME πŸŽ€

write_scf, fwrite_scf, write_scf_header β€” Write SCF files πŸ¦‹


✨ SYNOPSIS ✨

#include <scf.h>

int write_scf(
     Scf *scf,
     char *fn);

int fwrite_scf(
     Scf *scf,
     FILE *fp);

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

πŸ’… DESCRIPTION πŸ’…

So these three cuties write SCF format trace files. That's the whole vibe. πŸ‘‘

And here's a lil heads-up that applies to all of the functions that take a FILE * as an argument: they just assume the file pointer is sitting at the correct offset inside the file β€” which should be the start. They are not gonna check for you. They are trusting. Maybe too trusting. πŸ™ˆ

  • write_scf() β€” writes an entire SCF file into the Scf structure (peep the scf(4) manual page if you wanna know all the juicy details of that structure 🌸). The data gets written to the file name you specified. iconic.
  • fwrite_scf() β€” writes an entire SCF file into the Scf structure too (again, scf(4) has the deets on that structure πŸ’œ). This one writes the data to the file pointer you hand it, and β€” very important β€” that file pointer is neither closed nor rewound after the operation. so don't come for it later expecting it to have tidied up after itself, bestie. 😭
  • write_scf_header() β€” writes the Header structure to the file pointer you gave it. simple. elegant. slay. ✨

πŸ”₯ RETURN VALUES πŸ”₯

When everything goes perfectly (main character energy only), write_scf(), fwrite_scf(), and write_scf_header() all return 0. 🫢

If it does not go perfectly? These functions return -1. that's the whole story. πŸ’€


🌈 SEE ALSO 🌈


and that's the tea, bestie πŸ“ β€” this page comes to you courtesy of the Staden Package, and it's the write_scf(3) page, dated just like the original footer says. go forth and write some SCF files, you've totally got this πŸ’–βœ¨πŸŽ€