From: Pascal Obry <pascal@obry.net>
Subject: Re: Returning a string from C
Date: Thu, 23 Jul 2015 08:41:53 +0200
Date: 2015-07-23T08:41:53+02:00 [thread overview]
Message-ID: <1437633713.28927.0.camel@obry.net> (raw)
In-Reply-To: 27cd219d-fff7-4c2a-90c7-ec10a917b4cb@googlegroups.com
Le mercredi 22 juillet 2015 à 19:20 -0700, NiGHTS a écrit :
> I am having some difficulty with returning a string from a C
> function.
>
> Say I have the following C function:
>
> void Return_Hello (char *inout_Test_String ) {
> strcpy( inout_Test_String, "Hello World" );
> }
I would probably also pass the string length here and use strlcpy
instead to avoid any memory corruption.
--
Pascal Obry / Magny Les Hameaux (78)
The best way to travel is by means of imagination
http://v2p.fr.eu.org
http://www.obry.net
gpg --keyserver keys.gnupg.net --recv-key F949BD3B
next prev parent reply other threads:[~2015-07-23 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 2:20 Returning a string from C NiGHTS
2015-07-23 4:48 ` Jeffrey R. Carter
2015-07-23 4:54 ` Per Sandberg
2015-07-23 4:58 ` Laurent
2015-07-23 6:41 ` Pascal Obry [this message]
2015-07-23 7:17 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox