Mail Archives: djgpp/1997/12/14/11:48:13

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Prog works only in debugging (!)
Date: Sun, 14 Dec 1997 07:51:26 -0500
Organization: Cornell University (
Lines: 51
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <>
References: <344B8C3A DOT 96239E8F AT LSTM DOT Ruhr-UNI-Bochum DOT De> <19971214030100 DOT WAA05923 AT ladder01 DOT news DOT aol DOT com>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Myknees wrote:
> I am using RHIDE 1.4.  I have no optimization going on.  When I run 
> the program with Ctrl-F9, I get an unexpected result:
> "The string itself." backwards is:
> xxxxxxxxxxxxxxxxxx
> ...However, when I use F7 to step through the program, it works fine 
> and prints the following to the screen:
> "The string itself." backwards is:
> .flesti gnirts ehT

the subjet of your post is actually a comp.lang.c FAQ. i would suggest
you find it and read it. as for your problem:

>         for (len=0; s[len]!='\0'; len++)
>                 ;  //len = length of s.

well, this is not it put there is something called strlen you know.

>         //copy is the name of the address of the first element:
>         char *copy;
>         copy[len]='\0'; //give copy string a terminal nul
>         /* Next I initialize the copy string to "xxxxx..." so
>            that I can watch it easily when debugging. */
>         for (i=0; i<len; i++){
>                 copy[i]='x';
>         }

hmmm ... where does the memory come from?

you must realize that basic C questions such as this are off-topic for
this newsgroup.

in any case, i presume you are running under windows95. if you had been
in dos with cwsdpmi, your program would have crashed with a sigsev. from
the traceback, you would see exactly where you the illegal access was
occuring. windoows 95's dpmi server is broken, and let's you write
whereever you want, that's why your program seems to work at all.
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA

mailto:sinan DOT unur AT cornell DOT edu

- Raw text -

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