Hi Teo,
>Please take in mind the Viktor's advice. It's very dangerous to deal with >pointers at prg Harbour level, you can easily break things badly. I just use the function during Xbase++ to Harbour converting ... After that, I will re-think and re-write those part .... Thanks ! Shum Date: Sat, 27 Mar 2010 09:02:11 -0800 From: ml-node+4809931-358327461-334...@n2.nabble.com To: wcshu...@hotmail.com Subject: Re: Ask Str2Poniter() and Pointer2Str() function pair .... Hello Shum, On Mar 27, 2010, at 9:16 AM, Shum wrote: Hi Teo, I am converting my Xbase++ application into Harbour... Within my Xbase++ Application, I use BAP lib which are function for calling C function within Xbase++ and it has a function called Stringof() same as Pointer2Str() .... Without the Stringof() or similiar function .... I had to do much effort .... So I have the Stringof() or Pointer2Str() function in hand ...It can speed up my Xbase++ to Harbour convertion... Please take in mind the Viktor's advice. It's very dangerous to deal with pointers at prg Harbour level, you can easily break things badly. Bellow you'll find the String2Pointer/Pointer2String. Just keep in mind that for safety, the function Pointer2String returns a new PHB_ITEM with the copy of the pointers buffer. <prg> #pragma begindump #include "hbapi.h" HB_FUNC( STRING2POINTER ) { PHB_ITEM s = hb_param( 1, HB_IT_STRING ); if( s ) hb_retptr( (void *) hb_itemGetCPtr( s ) ); } HB_FUNC( POINTER2STRING ) { PHB_ITEM p = hb_param( 1, HB_IT_POINTER ); PHB_ITEM n = hb_param( 2, HB_IT_NUMERIC ); if( p && n ) { PHB_ITEM s = hb_itemNew( NULL ); hb_itemPutCL( s, hb_itemGetPtr( p ), hb_itemGetNI( n ) ); hb_itemReturnRelease( s ); } } #pragma enddump </prg> best regards, Teo _______________________________________________ Harbour mailing list (attachment size limit: 40KB) [hidden email] http://lists.harbour-project.org/mailman/listinfo/harbour View message @ http://n2.nabble.com/Ask-Str2Poniter-and-Pointer2Str-function-pair-tp4803834p4809931.html To unsubscribe from Re: Ask Str2Poniter() and Pointer2Str() function pair ...., click here. _________________________________________________________________ Hotmail 有 Microsoft 強力垃圾郵件保護機制,值得您信賴。 https://signup.live.com/signup.aspx?id=60969 -- View this message in context: http://n2.nabble.com/Ask-Str2Poniter-and-Pointer2Str-function-pair-tp4803834p4809944.html Sent from the harbour-devel mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour