New topic: Data Mapping
<http://forums.realsoftware.com/viewtopic.php?t=32151> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message mark.gregory Post subject: Data MappingPosted: Sat Jan 23, 2010 5:04 am Joined: Thu Jan 07, 2010 7:57 am Posts: 10 Guy's I have a complex problem I have a routine simple routine The plugin function is defined as {(REALproc) copySDESitems,REALnoImplementation,"copySDESitems(Source as MemoryBlock,Destination as MemoryBlock)",}, The function itself is defined as static void copySDESitems(REALmemoryBlock Source,REALmemoryBlock Destination) { Ptr s=(Ptr)REALMemoryBlockGetPtr((REALmemoryBlock)Source); Ptr d=(Ptr)REALMemoryBlockGetPtr((REALmemoryBlock)Destination); fprintf(stdout,"Source Data: %s\n",s); int len = s[1] & 0xFF; bcopy(s + 2, d, len); d[len] = 0; fprintf(stdout,"Destination Data: %s\n",d); } I want this to be a generic routine that I can pass a structure to and it will copy it The original function was defined as void copySDES(char *s,char *d) { same code less pointers } How can I make my routine generic, if in RB i have source and dest as strings for example I get a crash set them as memoryblocks and it does not crash but I of course get garbage at the end of the destination ram block. Dim s as new memoryblock(100) dim d as new memoryblock(100) s="this is a test" rtp.copysdes(s,d) d then has garbage .. Regards Mark Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
