delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/30/05:40:08

Message-ID: <32F0777F.4356@eagle.patra.hol.gr>
Date: Thu, 30 Jan 1997 12:27:11 +0200
From: Panos Platon Tsapralis <pan AT eagle DOT patra DOT hol DOT gr>
Reply-To: pan AT eagle DOT patra DOT hol DOT gr
Organization: Unisoft S.A.
MIME-Version: 1.0
To: "D.J.Delorie's DJGPP Compiler's NewsGroup" <djgpp AT delorie DOT com>,
Bill Lanam <billlanam AT california DOT com>
Subject: Re: Strange Behaviour ...
References: <32EDEBC4 DOT 49E1 AT eagle DOT patra DOT hol DOT gr> <32eff04f DOT 7017712 AT seashell DOT california DOT com>

Bill Lanam wrote:
> 
> On Tue, 28 Jan 1997 12:06:28 GMT, Panos Platon Tsapralis
> <pan AT eagle DOT patra DOT hol DOT gr> wrote:
> 
> >Dear friends,
> >
> >       I have been spending endless hours of work, trying to figure out why
> >the DJGPP compiler has this strange behaviour that I present below :
> >
> >..
> >char buffer[2048]
> >..
> >int main(void)
> >
> >{
> >..
> >strcpy(buffer,"string1"); /* Works O.K. - RHIDE debugger shows
> >buffer="string1" ... */
> >..
> >strcpy(buffer,"string2"); /* Old content of 'buffer' vanishes - RHIDE
> >debugger shows buffer="" !!! */
> >..
> >return(...);
> >}
> >
> >       Additional information that might be useful :
> >
> >       a)      I use the latest incarnations of all DJGPP components & RHIDE.
> >       b)      I get the strange behaviour in & out of Windows-95 ( on
> >MSDOS,Ver.7.0 cmd-line ).
> >       c)      I use GDBM,Ver.1.7.3 and PD_Curses,Ver.2.2.
> >       d)      I have no objection as to post the whole program's source code to
> >anyone that might be interested & willing to spend his or her valuable
> >time to help me.
> >       e)      Last but not least ( and certainly the craziest of all ! ) : when I
> >rearrange the code by moving the second 'strcpy' towards the beginning
> >of the program, everything works O.K. !!!
> >
> Perhaps string2 gets wiped out due to a pointer problem.
> 
>     Bill Lanam

	Dear Bill,

	the problem is that, immediately after the execution of the second
'strcpy' statement ( by pressing F8 in RHIDE ), I examine the contents
of the 'buffer' variable and nothing is in there, just an empty string.
I have also followed very carefully the instructions given to me by Mr.
Hoehne ( thanks very much Robert ), but to no avail. I simply found the
above : just after the execution of 'strcpy', before the execution of
any other statement, the 'buffer' contains nothing !!!

+----------------------------+
| Panos Platon Tsapralis,    |
| ( pan AT eagle DOT patra DOT hol DOT gr ) |
| ( pan AT hol DOT gr )             |
| Software Engineer,         |
| Unisoft S.A.,              |
| ( http://www.unisoft.gr )  |
| Athens, HELLAS.            |
+----------------------------+

- Raw text -


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