https://code.jsoftware.com/wiki/Vocabulary/Foreigns#m15
includes the text: "count must equal the number of atoms in (,x), except that if precision=2, count may be one more, to cause a zero byte to be appended." But by inspection we can see that a zero byte is not being appended. Thanks, -- Raul On Sun, Feb 27, 2022 at 10:04 AM Henry Rich <[email protected]> wrote: > > Sorry, I still don't see the error. Please refer to > > https://code.jsoftware.com/wiki/Vocabulary/Foreigns#m15 > > and indicate what is being done that doesn't match the description. > > Henry Rich > > On 2/27/2022 9:58 AM, Raul Miller wrote: > > s=: 'Hello world' > > write=: {{p [ y memw p,0,(>: # y),2 [ p=. mema >: # y}} > > read=: {{res [ memf y [ res=. memr y,0,_1,2}} > > > > (read@write&.> <\ s) -: <\ s > > 0 > > > > Inspecting the result with > > > > (read@write&.> <\ s) (;<)&,. <\ s > > > > We can see a conflict with a statement made at > > https://code.jsoftware.com/wiki/Guides/DLLs/Memory_Management (and > > other places): > > > > "If type is char, count can be 1 greater than the length of the string > > left argument, in which case a 0 is appended (writing a C string)." > > > > ------------------ > > > > I think the cause here is that the memw code was not updated to cope > > with virtual blocks. Prior to j901, that trailing 0 would have been > > added to the character list when it was written to memory. > > > > I hope this helps, > > > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
