Hi All,
I was toying around with an aSub Record to get it to generate an array...
So I've got this code:
static long gen_array(aSubRecord *precord)
{
long lx=1292;
long arr[lx];
long i=0;
for (i=0;i<lx;i++)
{
arr[i] = i;
}
memcpy(precord->vala,arr,precord->nova*sizeof(long));
return 0;
}
and this record:
record(aSub, "MyASubRecord") {
field(SNAM, "gen_array")
field(FTVA, "LONG")
field(NOVA, "1292")
}
Given the value of lx, I would expect to see VALA with 0,1,2,3,4...1291
But I do a caget MyASubRecord.VALA, I get this:
MyASubRecord.VALA 1292 0 0 1 0 2 0 3 0 4... 644 0 645 0
The number of elements is correct, i.e. 1292, but there are 0s interlaced with the correct data ??? I'm sure it's something silly, but I cannot figure it out.
Thanks
David