From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd037befc4df6bdc X-Google-Attributes: gid103376,public From: mcc@tyrolia.cs.princeton.edu (Martin C. Carlisle) Subject: Re: ObjectAda: LPCSTR -> STRING ? Date: 1998/01/06 Message-ID: <68tgdg$c7c$1@cnn.Princeton.EDU>#1/1 X-Deja-AN: 314627589 References: <884055877.1213464581@dejanews.com> Organization: US Air Force Academy, Dept of Computer Science Newsgroups: comp.lang.ada Date: 1998-01-06T00:00:00+00:00 List-Id: In article <884055877.1213464581@dejanews.com>, wrote: >I'm working with Aonix ObjectAda 7.1 and I need to figure >out a way to convert a LPCSTR to an Ada STRING. I'd appreciate >any help. Thanks. One must assume your question is a Win32Ada question, not specific to Object Ada. LPCSTR is equivalent to C's (const char *). I'd suggest something along the following: function To_String(c_pointer : in Win32.LPCSTR) return String is length : natural; Ignore_lpstr : Win32.LPSTR; begin length := Natural(Win32.Winbase.lstrlen(c_pointer)); declare result : String(1..length+1); begin Ignore_lpstr := Win32.Winbase.lstrcpy(result'address, c_pointer); return result(1..length); -- omit null terminating character end; end To_String; --Martin -- Martin C. Carlisle, Computer Science, US Air Force Academy mcc@cs.usafa.af.mil, http://www.usafa.af.mil/dfcs/bios/carlisle.html DISCLAIMER: This content in no way reflects the opinions, standard or policy of the US Air Force Academy or the United States Government.