Mail Archives: djgpp/1999/02/07/14:22:31
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 -