Re: [QUESTION] toupper problems

From: Ryan Gasper or Steven Arnold (dalamar@CYBERCOM.NET)
Date: 12/12/97


On Fri, 12 Dec 1997, d. hall wrote:

> : thus on Fri, 12 Dec 1997 09:03:38 -0500, Ryan virtually wrote:
>
> Ryan> I am trying to take an argument, buf2, toupper it, and then copy that
> Ryan> into a char pointer like so: *choice = toupper(*buf2); I have added
> Ryan> log comments in every step of my code, and it does not get by this
> Ryan> line. Is this valid code on *Nix box? I made a sample program that
> Ryan> did the same thing with MSVC 5.0 and had no problems. It copied over
> Ryan> fine, but crashes on my BSD machine with a Seg fault. If this is Ok,
> Ryan> then why doesn't the log file log my next comment right after it?
>
> Let's start with obvious and move down.
>
> Is choice a pointer to a char?
> Does choice actually point to a valid char array (string?)?
> Does choice pointer to a const char array?

        char *choice = '\0';
>
> seg fault normally means you're writing to memory you haven't alloc'ed.
>
> It's normally easier running your server in a debugger, or if that's not
> possible, run a stack trace on the core file.

        Not getting a core file, and not sure how to force one.

        _\|/_____________________________\|/_ Ryan Lane Gasper _\|/_
         /|"You will never see me cause    \/------------------\/|\
          | I'm always alone" -Ministry      dalamar@cybercom.net|
          |"The tree of liberty must be refreshed from time to   |
        _\|_time_with_the_blood_of_patriots_and_tyrants"_-ThomasJ|/_
         /|\                     -*-1997-*-                     /|\



     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST