🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7658

Re: DrawTextEx

#7658
From: Hans Galema
Date: Mon, 03 Jan 2005 17:40
16 lines
1316 bytes
Petar Popara wrote:

> char a[200];
> strncpy(a, cFileName.c_str(), 199);

If cFileName.Length() >=199 then the contents of a[] will not be \0 terminated.

So add: a [199] = 0;

But for better readibility just make the buffer one byte bigger:

   char a[200+1];
   strncpy(a, cFileName.c_str(), 200);
   a[200] = 0;

Hans.
Technical Details
Message-ID: <41d983be@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41d5500e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,42d3caa052e60398
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 03 Jan 2005 18:40:35 +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.nativeapi
Subject: Re: DrawTextEx
References: <41d5500e$1@newsgroups.borland.com>
In-Reply-To: <41d5500e$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <41d983be@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1104774078 129.125.201.248 (3 Jan 2005 09:41:18 -0800)
Lines: 16
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail