Mail Archives: djgpp/1999/10/05/07:50:21
On Tue, 5 Oct 1999 hank_heng AT hotmail DOT com wrote:
> I try to debug it with "symify", it point back to the end of file is
> causing error, this does not make any sense at all...
It *will* make sense if you read section 12.2 of the DJGPP FAQ list,
which specifically mentions the case where the traceback points to the
closing brace of a function, or to its return statement. The reason
for this is that you write over the return address on the stack by
overwriting some local variable.
> main()
> {
> int test=3;
> char destination;
> void *des = &destination;
>
>
> /* capture screen character */
> test = gettext(10, 10, 20, 20, des);
And here's the villain: `destination' is declared `char', so only
a single-byte storage is allocated for it. But `gettext' needs that
its last argument point to a buffer large enough to hold all the
characters retrieved from the screen portion specified by the other
arguments. In your case, you need 10*10*2 = 200 bytes.
The following should make this work (warning: untested!):
void *des = malloc (200);
- Raw text -