[fpc-pascal] Adding a array of float in ressource and use it ?
pascaldragon at googlemail.com
Tue Mar 7 20:38:58 CET 2017
On 07.03.2017 16:30, fredvs wrote:
>>> Many thanks Sven for your help.
>>> Do you agree if I add your name into the list of the "great contributors"
>>> uos (https://github.com/fredvs/uos) ?
>> I don't think that's necessary. I'm merely doing my "job"...
> OK, I understand. (But I ask it always when I get great help, it is a matter
> of conscience and respect.)
>>> Huh? Of course you can do that rather similary in C as well.
>> Indeed. You can do exactly the same. You can do this:
> Huh in C, in one shot, like fpc does, without conversion and working?
The following code reads the floatbuf.txt file that my Pascal example
code generated and correctly prints 3.141500 42 times:
=== code begin ===
file = fopen("floatbuf.txt", "rb");
printf("Failed to open file\n");
floatbuf = malloc(sizeof(float) * 42);
if (fread(floatbuf, sizeof(float), 42, file) != 42)
printf("Failed to read data\n");
for (int i = 0; i < 42; i++)
=== code end ===
More information about the fpc-pascal