Mail Archives: cygwin/1998/08/29/00:56:00
Hallo Mark, you wrote:
>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");
>
>}
You're trying to change a global allocated string constant that AFAIK
isn't guaranteed to be changeable on any system and compiler. IMHO I
sometime read something about systems that protect their global
constants against changing which could be happening here with NT.
Just try something like:
int main(int argc, char *argv[])
{
char pBuffer[] = "Hello you";
strtolower(pBuffer);
printf("Success\n");
}
or
char pBuffer[] = "Hello you";
int main(int argc, char *argv[])
{
strtolower(pBuffer);
printf("Success\n");
}
Then you're changing an global or local array which should work on any
system. But perhaps there's a compiler switch somewhere...
Any comments from the experts? :)
--
bis denne, Michael
Elefanten spielen nicht Schach!
-
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".
- Raw text -