Article View: borland.public.cppbuilder.nativeapi
Article #11145Re: Problem with GetComputerName
From: Remy Lebeau (TeamB)
Date: Mon, 23 Feb 2004 18:42
Date: Mon, 23 Feb 2004 18:42
14 lines
1500 bytes
1500 bytes
"Koen" <koen@not.this.cerm.be> wrote in message news:Xns949877408AF07koencermbe@207.105.83.66... > I still do have 1 question about this code: Shouldn't size be initialized > to MAX_COMPUTERNAME_LENGTH + 1 (= sizeof (name))? You could, but it is safer not to. By omitting the +1 in the buffer size while keeping it in the buffer itself, that allows the buffer to always have room for a null terminator in case the function fills the buffer to its maximum capacity, thus truncating off the null terminator. Gambit
Technical Details
Message-ID:
<403a4794$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40392bec$1@newsgroups.borland.com> <40393b85$1@newsgroups.borland.com> <Xns949877408AF07koencermbe@207.105.83.66>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ac942ffac7941132 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-23 10:40:27 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <40392bec$1@newsgroups.borland.com> <40393b85$1@newsgroups.borland.com> <Xns949877408AF07koencermbe@207.105.83.66> Subject: Re: Problem with GetComputerName Date: Mon, 23 Feb 2004 10:42:03 -0800 Lines: 16 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.138.253 Message-ID: <403a4794$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077561236 67.22.138.253 (23 Feb 2004 10:33:56 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail