www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/23/23:46:40

From: Radical NetSurfer <radsmail AT juno DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: memset behavior
Date: Wed, 23 Aug 2000 23:37:41 -0400
Message-ID: <s269qsgaqr5446ot429cat1q8vo7rq5t9c@4ax.com>
X-Newsreader: Forte Agent 1.8/32.548
X-No-Archive: yes
MIME-Version: 1.0
NNTP-Posting-Host: 216.202.140.67
X-Original-NNTP-Posting-Host: 216.202.140.67
X-Trace: 23 Aug 2000 23:40:36 -0400, 216.202.140.67
Lines: 38
X-Original-NNTP-Posting-Host: 64.31.79.51
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I had a line of code like this:

char buffer[100];

printf("%d %s\n",  (char*)memset(buffer, '-', 64));


and what was discovered is:

       IF buffer already contains a string,  "ABCD",
THEN memset() as above printed:

"-------------------------------------------------------------BCD"
(truncated to fit here)

OBSERVE: that the everything was MOVED DOWN
      THEN:  the dashed-line added.

QUESTION: Why would this be ?

PROBLEM #2:
There's no such thing as a    memcat()  routine...
why?  How can binary data (data containing 0x00) be
CONCATED to accurately and properly return the
size (pointer growth) of a buffer?

(growing_pointer *)memcat(destination, source, n_bytes);

such that "growing pointer" is simply something that provides
the buffer address of 'source', and its length.

Any ideas here?

THANKS

Email welcomed: radsmail AT juno DOT com
URL: members.tripod.com/~RadSurfer/

- Raw text -


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