PX_PUT_DATA_LONG(3)

πŸ’– PX_PUT_DATA_LONG πŸ’–

okay so bestie, welcome to the PX_put_data_long(3) page from the Library Functions Manual β€” yes she's a library function, yes she's serving, and yes she is literally the only correct way to stuff a long value into a record. let's get into it 🫢


✨ NAME ✨

PX_put_data_long β€” put a value into a long data field πŸ’…

like. that's the whole job. putting a value. into a long field. iconic behavior honestly.


🌸 SYNOPSIS 🌸

#include <paradox.h>

void PX_put_data_long(pxdoc_t *pxdoc, char *data, int len, int value)

look at her. four args, returns nothing, zero drama. void girlies rise 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

so what's actually happening here? PX_put_data_long converts an integer into a value for a data field as it is stored in the database file. that's the whole vibe β€” you hand it an int, it hands the database the exact bytes the database wants. matchmaker energy fr fr πŸ’ž

bestie listen. you should use this function instead of accessing the record data directly. do not go poking at the raw bytes yourself. that's not the move. that is never the move. πŸ™ˆ

now, about data β€” she points to the start of the data field in the record. but here's the part where you have to actually do math (i know, i know, stay with me πŸ’€):

to get that pointer, you sum up all field length before the field to operate on, and then add it to the base pointer of the record.

so like:

data = base_pointer_of_record + (sum of all field lengths before this field)

and then you pass that data in. that's it. that's the whole ritual. do the sum, add it to the base pointer, hand over the pointer, let the function cook. no cap. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

her sisters!! the whole put-data family, all in their own manual pages:

collect the whole set, they're all giving πŸŽ€


πŸŽ€ AUTHOR πŸŽ€

this manual page was written by Uwe Steinmann uwe@steinmann.cx. thank you for your service, we are obsessed 🫢✨


and that's the page!! Library Functions Manual, PX_PUT_DATA_LONG(3), no date on this one so don't come for me β€” she's undated and unbothered, main character energy only πŸ’œπŸŒΈ