From: sholden AT pgrad DOT cs DOT usyd DOT edu DOT au (Sam Holden) Subject: Re: BUG in function parameter passing ?????? 28 Aug 1998 05:03:04 -0700 Message-ID: <199808280336.UAA22117.cygnus.gnu-win32@cygnus.com> References: <98082711213612 AT psicla DOT psi DOT ch> Reply-To: sholden AT cs DOT usyd DOT edu DOT au Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Mark DOT Koennecke AT psi DOT ch Cc: GNU-WIN32 AT cygnus DOT com Mark DOT Koennecke AT psi DOT ch writes: > >#include >#include >#include >#include >/*---------------------------------------------------------------------------* >/ > void strtolower(char *pText) > { > int i; > char *pPtr; > > assert(pText); > > for(i = 0, pPtr = pText; i < strlen(pText); i++, pPtr++) > { > *pPtr = tolower(*pPtr); > } > } >/*---------------------------------------------------------------------*/ > >int main(int argc, char *argv[]) >{ > char pBuffer[132]; > > /* why does this work? */ > strcpy(pBuffer,"Hello You"); > strtolower(pBuffer); > > /* but this gives a segmentation violation under Cygwin*/ > strtolower("Hello You"); > > printf("Success\n"); > >} Which is expected since "Hello You" is a constant string and thus ends up in memory which is read only... Sam --- There's no such thing as a simple cache bug. --Rob Pike - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".