Article View: comp.sys.lang.c++
Article #8Re: Question for C Programmers...
From: Marc Boily
Date: Wed, 11 Sep 1996 00:00
Date: Wed, 11 Sep 1996 00:00
42 lines
1819 bytes
1819 bytes
it's simple !!!
char *example;
main()
{
example = (char *)malloc( 10 + 1 ); /* +1 for the NULL */
strcpy( example, "abcdefghij" );
example[10] = 0x00; /* 10 because the first is 0 */
/* 0x00 =
\0 */
}
--
Marc Boily
Marc.Boily@CGI.CA
:-)
bastards <bastards@ntic.qc.ca> wrote in article
<01bb9f5e$eb2c1ea0$5caceccd@bastards.ntic.qc.ca>...
> Hi! First : I'm new to C language. :)
>
> Second: I would like to know if somebody could tell me how I could add a
> Caractere "0" after a string... something like:
>
> My_String = "A_TEST" + CHR(10);
>
> But, unfortunatly the "CHAR" function dosn't exist... :( so what
should
> I do?
>
> THanks a lot folks!
>
>
> Ed.
>
>
>
>
>
Technical Details
Message-ID:
<01bb9ff3$71e7b320$6fa497cd@destroy.qc.cgi.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bb9f5e$eb2c1ea0$5caceccd@bastards.ntic.qc.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10edc6,882dc48c93e679cf X-Google-Attributes: gid10edc6,public X-Google-Thread: 167642,882dc48c93e679cf X-Google-Attributes: gid167642,public X-Google-Thread: 10c73c,882dc48c93e679cf X-Google-Attributes: gid10c73c,public X-Google-Thread: 10b7bb,882dc48c93e679cf X-Google-Attributes: gid10b7bb,public X-Google-Thread: 108b44,882dc48c93e679cf X-Google-Attributes: gid108b44,public X-Google-Thread: fffda,882dc48c93e679cf X-Google-Attributes: gidfffda,public X-Google-Thread: 10caf2,882dc48c93e679cf X-Google-Attributes: gid10caf2,public From: "Marc Boily" <Marc.Boily@CGI.CA> Subject: Re: Question for C Programmers... Date: 1996/09/11 Message-ID: <01bb9ff3$71e7b320$6fa497cd@destroy.qc.cgi.ca> X-Deja-AN: 179920129 references: <01bb9f5e$eb2c1ea0$5caceccd@bastards.ntic.qc.ca> organization: CGI newsgroups: comp.sys.lang.c++,ctdl.lang.c++,de.comp.lang.c++,fj.lang.c++,hepnet.lang.c++,ibm.ibmpc.c++,sb.lang.c++