Freepascal and binary files? (Developers)
> Does anybody know whether is possible to somehow include files with binary
> data into Freepascal sources?
> It would be nice for things like bundled fonts, icons etc.
Not sure what you're asking here. Clearly you know more about (Turbo) Pascal than I do. I feel like I'm telling you what you already know.
Classic Pascal didn't allow including constant data. (EDIT: The only aggregate data allowed by J&W was strings like "const Msg = 'Hello!';".) TP extended the const keyword for initialized (writable) constant data. So just initialize a constant array. (Or is that too tedious? Do you want an automated way? Not sure offhand what tools would simplify that or what other alternatives exist.)
Obviously, if you bundle binary data, it makes the data harder to modify with third-party tools or reuse with other programs. Often people resort to WAD/PAK/ZIP archives to hold multiple files. (Yes, I realize tons of external files is annoying. I also think a super-bloated .EXE is bad, too. Code and data should "mostly" be kept separated.)
There's also a good FPC wiki article on file handling in Pascal with modern Delphi niceties (TStringList, TFileStream, TMemoryStream).
Complete thread:
- Freepascal and binary files? - Laaca, 20.05.2020, 23:15 (Developers)
- Freepascal and binary files? - RayeR, 21.05.2020, 01:46
- Freepascal and binary files? - Laaca, 21.05.2020, 10:36
- Freepascal and binary files? - Rugxulo, 21.05.2020, 02:27
- Freepascal and binary files? - marcov, 21.05.2020, 12:25
- Freepascal and binary files? - Laaca, 21.05.2020, 17:30
- Freepascal and binary files? - marcov, 22.05.2020, 13:17
- Freepascal and binary files? - Laaca, 21.05.2020, 17:30
- Freepascal and binary files? - Rugxulo, 31.05.2020, 18:50
- Freepascal and binary files? - CandyMan, 11.06.2020, 12:29
- Freepascal and binary files? - Laaca, 12.06.2020, 07:37
- Freepascal and binary files? - Laaca, 29.10.2021, 00:17
- Freepascal and binary files? - tkchia, 30.10.2021, 07:33
- Freepascal and binary files? - Laaca, 30.10.2021, 12:29
- Freepascal and binary files? - tkchia, 30.10.2021, 19:01
- Freepascal and binary files? - Rugxulo, 28.08.2022, 23:21
- Freepascal and binary files? - tkchia, 30.10.2021, 19:01
- Freepascal and binary files? - Laaca, 30.10.2021, 12:29
- Freepascal and binary files? - tkchia, 30.10.2021, 07:33
- Freepascal and binary files? - RayeR, 21.05.2020, 01:46