FINDLINE(3)

πŸ“¦
version 2022.10.16 Β· 2 versions
, in opensuse-leap 16.0

✨ FINDLINE(3) bestie era ✨

okay so this lil page is FINDLINE(3), living under SchilyΒ΄s LIBRARY FUNCTIONS β€” and it's lowkey iconic if you need to find a line with a matching field πŸ’…


✨ NAME ✨

findline() β€” finds a line that has a matching field πŸŽ€

🌸 SYNOPSIS 🌸

int findline(fname,delim,string,field,array,arraysize)
     char *fname;   /* file name */
     char delim;    /* field delimiter */
     char *string;  /* string to match */
     int field;     /* field number to match, 0-n */
     char *array[]; /* array to fill pointers in */
     int arraysize; /* number of entries in the arrays */

πŸ’– DESCRIPTION πŸ’–

okay so findline() retrieves specific fields from the first line of the file fname. main character behavior fr fr ✨

findline() fills in array with pointers to strings that make up the fields on the line. The strings are allocated new storage β€” fresh memory, slay 🫢

The field delimiter, delim, is used to break up each line of the file into fields. string is the string to match. fieldno is the field number to match. Fields are numbered 0..n. array is an array of pointers to fill in. arraysize is the number of elements in the array.

tiny vibe note bestie: the synopsis calls that arg field, and the description calls it fieldno β€” same matching-field energy, iykyk πŸ‘‘.

πŸŽ€ RETURNS πŸŽ€

  • +1 β€” match πŸŽ‰
  • -1 β€” no match πŸ™ˆ
  • -2 β€” arg error πŸ’€
  • -3 β€” cannot open file 😭
  • -4 β€” not enough memory to allocate space for fields πŸ”₯

πŸ¦‹ NOTES πŸ¦‹

⚠️ Each line of the file must be less than 512 characters long. no cap, that's the limit bestie 🌸

xoxo, Joerg Schilling, 2022/09/09 πŸ’–

πŸ“¦ where this page comes from