[A89] Re: C Problems


[Prev][Next][Index][Thread]

[A89] Re: C Problems




You probably overflow something, probably a static or global array, so that 
you overwrite part of your own program.
Or, you mess up some pointer you are writing data to, so that it happens to 
point into your program where the constant string is stored.
Even though it is constant, after compilation there is no actual difference 
between constant data nonconstant data and program code. You can change all 
of it. Sometimes usefull (self modifying code for example) but many times 
it can give strange bugs like this if you aren't carefull with pointers and 
making sure you don't write more to an array that fits in it.
I can't guarantee this is it with this info ofcourse, but it sounds likely, 
and a good place to start looking.

///Olle

At 07:30 2001-09-01, you wrote:

>         I have two problems with a TIGCC program I am making:
>One, after I run the game part of my game (as opposed to the menu
>screen), the menu screen strings have been replaced by "f-f-f-f-f-f-".
>This works for a while, until you try to exit at which point you receive
>an address error.  Any ideas?  An example of what would get screwed up
>is:
>   printf_xy(45, 40, "Start Game");
>would later print "f-f-f-f-f-".  I could understand a variable being
>messed with, but a constant string!?
>
>Secondly, maybe I'm over-looking something, but is there any good way to
>pause for a short amount of time in TIGCC?  I would like to slow the game
>down, and I don't like empty for-loops, but I will use one if I have to.
>
>                                                         Thanks,
>                                                                 -Dave
>"You puff the poets of other days, / the living you deplore. / Spare me
>the accolade: your praise / Is not worth dying for." - Martial
>________________________________________________________________
>GET INTERNET ACCESS FROM JUNO!
>Juno offers FREE or PREMIUM Internet access for less!
>Join Juno today!  For your FREE software, visit:
>http://dl.www.juno.com/get/tagj.





References: