🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3267

Re: i need ideas/comments with tclientsocket

#3267
From: Hans Galema
Date: Tue, 01 Nov 2005 08:54
20 lines
1610 bytes
Remy Lebeau (TeamB) wrote:

>     char *buf = "1234567890";
>     int len = 10;

To handle the len for all situations where strings are to
be transported I would write

      char *buf = "1234567890";
      int len = strlen ( buf );

but rather yet

   len = strlen ( buf ) +1;

The +1 cares for sending of the terminating zero.
This comes in quite handy on the receiving side where the string
is then zero teminated also.

Hans.
Technical Details
Message-ID: <43672d94$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43662baf$1@newsgroups.borland.com> <43667112$1@newsgroups.borland.com> <4366ccd3$1@newsgroups.borland.com> <4366d53d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5c33b8c6a9ca7fdb
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 01 Nov 2005 09:54:39 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: i need ideas/comments  with tclientsocket
References: <43662baf$1@newsgroups.borland.com> <43667112$1@newsgroups.borland.com> <4366ccd3$1@newsgroups.borland.com> <4366d53d$1@newsgroups.borland.com>
In-Reply-To: <4366d53d$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 145.98.201.248
Message-ID: <43672d94$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130835348 145.98.201.248 (1 Nov 2005 00:55:48 -0700)
Lines: 20
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail