delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/07/14:22:31

From: robin AT hyperion22 DOT freeserve DOT co DOT uk (Robin Pell)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is that bug ?
Date: Sun, 07 Feb 1999 19:10:33 GMT
Organization: Customer of Planet Online
Lines: 49
Message-ID: <36bdc4b8.48822@news.freeserve.net>
References: <36BC27D0 DOT 41C67EA6 AT uic DOT rnd DOT runnet DOT ru>
NNTP-Posting-Host: modem-79.claritin.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 918414940 11462 62.136.57.207 (7 Feb 1999 19:15:40 GMT)
NNTP-Posting-Date: 7 Feb 1999 19:15:40 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

If you're trying to set the buffer to NULLs, you need to use
memset, eg:

#include <stdlib.h>

int main( void )
{
  char buffer[1024];
  memset( buffer, NULL, sizeof( buffer ) );
  return 0;
}

memcpy copies one chunk of memory to another, eg:

#include <stdlib.h>

int main(void)
{
  char buffer1[1024], buffer2[1024];
  memcpy(buffer2, buffer1, sizeof( buffer ) );
  return 0;
}

Hope this helps,

Rob.

On Sat, 06 Feb 1999 11:30:24 +0000, George Lugovoy
<glugovoy AT uic DOT rnd DOT runnet DOT ru> wrote:

>I has a program:
>
>//////////////////////////////////////////////////////////////////////
>#include <stdlib.h>
>
>int main( void )
>{
>  char buffer[1024];
>  memcpy( buffer, NULL, sizeof( buffer ) );
>  return 0;
>}
>//////////////////////////////////////////////////////////////////////
>
>Under DOS, Unix that program is crashed, BUT
>under Windows that program won't crash.
>What is it ? Is that bug ?
>
>- George

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019