Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Wolfgang Riedmann" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: Strange issue with Item API Date: Fri, 26 Feb 2016 11:39:47 +0100 Lines: 73 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: individual.net IEwqvqeTT/aLNZL9aVJKGQvBbtpwNseiOmhQfQlUA6Wr4u54Y= Cancel-Lock: sha1:HlTAURAJmQPthj+Xotayh/b1OK4= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:9048 Hi Martin, do you lock the GC when calling the C code, or do you are protecting your array in VO, maybe with one of the OldSpace... functions? Personally, I don't knew that the item API was working in VO, maybe you should try to rewrite the code to use the normal C interface. Since Clipper was a 16 bit system, and VO is a 32 bit system, this could be another source of problems - I don't know if the Item API was adjusted when porting from VO 1.0 (16 Bit) to VO 2.x (32 Bit). Wolfgang Martin wrote: > This is some code from our routine to read a string from a 2D array. > And we are getting a very stange issue > > > If the string contains a ; everything goes mad > > The text on screen or report in C is blank, but hard reading the > string letters gices text from a different array and element. > > This is totally wierd, the code has been like this since we started > in Windows and then that code was migrated from the Clipper ITEM API > > Does anyone have any ideas why we are getting strange behavior when > reading an array in C when there is a ;? > > Thanks > > Martin > > > > ITEM subarr; > ITEM elem; > LPSTR str2; > UINT Type1, Type2; > > > // Get the sub array > subarr = ItemArrayGet(array, (UINT) row ); > G3itemRegister(&subarr); > > // Get the element > elem = ItemArrayGet(&subarr, (UINT) element ); > G3itemRegister(&elem); > > // Get the contents of element > Type1 = ItemType(&elem); > str2 = ItemGetC( &elem ); > > //wcscpy( (wchar_t *) str, (wchar_t *) str2 ); > strcpy(str, (char *)str2); > > // Release string > ItemFreeC( (LPBYTE) str2 ); > > // Free sub array > G3itemRelease( &elem ); > > // Free main array > G3itemRelease( &subarr ); --