🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.lang.c++
Article #9

Re: Question for C Programmers...

#9
From: Andreas Stolle
Date: Sat, 14 Sep 1996 00:00
50 lines
2146 bytes
Marc Boily wrote:
> 
> 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.
> >
> >
> >
> >
> >

Even simplier:

char *test="abc\012";

MFG Andreas
Technical Details
Message-ID: <323A9225.68B4@compuserve.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bb9f5e$eb2c1ea0$5caceccd@bastards.ntic.qc.ca> <01bb9ff3$71e7b320$6fa497cd@destroy.qc.cgi.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: 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
X-Google-Thread: 10c73c,882dc48c93e679cf
X-Google-Attributes: gid10c73c,public
X-Google-Thread: 10b7bb,882dc48c93e679cf
X-Google-Attributes: gid10b7bb,public
From: Andreas Stolle <100761.1473@compuserve.com>
Subject: Re: Question for C Programmers...
Date: 1996/09/14
Message-ID: <323A9225.68B4@compuserve.com>
X-Deja-AN: 180560391
references: <01bb9f5e$eb2c1ea0$5caceccd@bastards.ntic.qc.ca> <01bb9ff3$71e7b320$6fa497cd@destroy.qc.cgi.ca>
content-type: text/plain; charset=us-ascii
organization: SOG Systeme
mime-version: 1.0
newsgroups: comp.sys.lang.c++,ctdl.lang.c++,de.comp.lang.c++,fj.lang.c++,hepnet.lang.c++,ibm.ibmpc.c++,sb.lang.c++
x-mailer: Mozilla 3.0 (Win95; I)