FILE_TO_PASCAL_DATA(1)
π FILE_TO_PASCAL_DATA(1) β bestie edition π
okay so picture this: you're in the User commands section of the manual (section 1, obviously, iykyk), and you've got a file. and you want that file inside a Pascal program. not linked, not read at runtime β embedded. like, baked right in. that's literally what these two little icons do and I'm obsessed. β¨
πΈ NAME πΈ
file_to_pascal_data, file_to_pascal_string β the way that they convert files to Pascal source code. no cap. π
π¦ SYNOPSIS π¦
file_to_pascal_data INPUT_FILE OUTPUT_FILE
file_to_pascal_string INPUT_FILE OUTPUT_FILE
π DESCRIPTION π
so here's the tea, bestie: the file_to_pascal_data and file_to_pascal_string programs can be used to convert files to Pascal source code, so you can embed data inside Pascal programs. main character energy fr fr. π
file_to_pascal_data encodes INPUT_FILE as an Array of Byte, whereas file_to_pascal_string encodes it as a string literal.
two programs, two vibes, same job: get your bytes into a .inc and go π
π EXAMPLES π
okay so consider a file containing only the text "Example" (with a newline character at the end) being used as the input. tiny file, huge potential. π
after converting the input using file_to_pascal_data, the output file can be used like in the following example:
const EmbeddedData: {$INCLUDE output_data.inc};
after including the file, this will evaluate to something like:
const EmbeddedData: array[0..7] of byte = (
$45, $78, $61, $6D, $70, $6C, $65, $0A
);
look at those eight little bytes. $0A at the end is the newline, she's shy but she's there. π
the output generated by file_to_pascal_string can be used in a similar fashion:
const EmbeddedString = {$INCLUDE output_string.inc};
after including the file, this will evaluate to something like:
const EmbeddedString = 'Example' + LineEnding;
see how it kept the newline as LineEnding instead of hardcoding it? that's range, that's taste, that's portability. slay. π₯
π SEE ALSO π
and that's the whole page, bestie. you ate. πβ¨π¦πΈ this one's dated 2021-09-22, from the User commands corner of the world β go embed something iconic. periodt. π
π¦ where this page comes from
- fedora 43: pasdoc-tools 0.16.0-14.fc43 Β· GPL-2.0-or-later
- fedora 44: pasdoc-tools 0.16.0-15.fc44 Β· GPL-2.0-or-later
- fedora 44: pasdoc-tools 1.0.4-1.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms