>OK. Here's what I ended up doing. Please let me know if there's an >easier way. > Yes there is ! And it has already been posted (12/01/98) : LP : Win32.LPCSTR; S : String := Interfaces.C.Strings.Value (Win32.To_Chars_Ptr (LP)); Pascal. -- --|------------------------------------------------------------ --| Pascal Obry Team-Ada Member | --| | --| EDF-DER-IPN-SID- Ing�nierie des Syst�mes d'Informations | --| | --| Bureau G1-010 e-mail: pascal.obry@der.edfgdf.fr | --| 1 Av G�n�ral de Gaulle voice : +33-1-47.65.50.91 | --| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 | --| FRANCE | --|------------------------------------------------------------ --| --| http://ourworld.compuserve.com/homepages/pascal_obry --| --| "The best way to travel is by means of imagination" matthew_snyder@hotmail.com a �crit dans le message <885329887.836370436@dejanews.com>... > type CHARACTER_POINTER is access CHARACTER; > > function TO_CHARACTER_POINTER is new ADA.UNCHECKED_CONVERSION( >WIN32.LPCSTR, CHARACTER_POINTER ); function TO_UNSIGNED_32 is new >ADA.UNCHECKED_CONVERSION( WIN32.LPCSTR, UNSIGNED_32 ); function >TO_LPCSTR is new ADA.UNCHECKED_CONVERSION( UNSIGNED_32, WIN32.LPCSTR ); > > > procedure TO_ADA_STRING( STRING_PTR : in WIN32.LPCSTR; > NEW_STRING : in out STRING; > LAST : in out INTEGER ) is > > TEMP_STRING_PTR : WIN32.LPCSTR := STRING_PTR; > ADA_STRING : STRING( 1 .. 80 ); > TEMP_32 : UNSIGNED_32; > CHAR_PTR : CHARACTER_POINTER; > > begin > > -- Get the length of the string > LAST := INTEGER( WIN32.WINBASE.LSTRLEN( STRING_PTR ) ); > > -- Loop through and copy "C" string to Ada string > for STRING_INDEX in 1 .. LAST loop > > -- Convert the string pointer to a character pointer > CHAR_PTR := TO_CHARACTER_POINTER( TEMP_STRING_PTR ); > -- Add the character to the ada string > ADA_STRING( STRING_INDEX ) := CHAR_PTR.all; > > -- Convert the string pointer to an unsigned 32 > TEMP_32 := TO_UNSIGNED_32( TEMP_STRING_PTR ); > -- Increment the unsigned 32 > TEMP_32 := TEMP_32 + 1; > -- Convert the unsigned 32 back to a string pointer > TEMP_STRING_PTR := TO_LPCSTR( TEMP_32 ); > > end loop; > > NEW_STRING( 1 .. NEW_STRING'LAST ) := ADA_STRING( 1 .. NEW_STRING'LAST >); > > end TO_ADA_STRING; > >-------------------==== Posted via Deja News ====----------------------- > http://www.dejanews.com/ Search, Read, Post to Usenet