🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

But why not use ?

#9435
From: Edward
Date: Wed, 07 Jul 2004 17:57
41 lines
1758 bytes
Man this code doenst work here.

Maybe it is the declaration:

  char biosnro[256];

  memset(biosnro,' ', strlen(biosnro));


But why not use ?
  i=0;
  while(i < sizeof(biosnro))
  {
    biosnro[i] = ' ';
    i++;
  }


Edward


"Norm Jaffe" <mail@aurelsystems.com> escreveu na mensagem
news:40ec2bad$3@newsgroups.borland.com...
> > But about memset it doesnt work man:
> >
> >   strcpy(biosnro,"inistr");
> >   memset(biosnro, ' ', strlen(biosnro) - 1);
> >
> [snip]
>
> It's much simpler (and more efficient) to do:
>
>    memset(biosnro, ' ', sizeof(biosnro) - 1);
>
> If you _must_ use strlen(), then the code should be:
>
>   memset(biosnro, ' ', strlen(biosnro));
>
> Norm
>
>
Technical Details
Message-ID: <40ec3a05@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com> <40eb8d7b$1@newsgroups.borland.com> <40ec23f0@newsgroups.borland.com> <40ec2bad$3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e3066f787953dff9
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Edward" <Registrados2004@aol.com>
From: "Edward" <Registrados2004@aol.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com> <40eb8d7b$1@newsgroups.borland.com> <40ec23f0@newsgroups.borland.com> <40ec2bad$3@newsgroups.borland.com>
Subject: But why not use ?
Date: Wed, 7 Jul 2004 14:57:52 -0300
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 200.213.49.155
Message-ID: <40ec3a05@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089223173 200.213.49.155 (7 Jul 2004 10:59:33 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail