"milkyway" <d0******@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hello out there,
When one gets an error, they can use
fprintf (Stdout, "File %s Line %d\n", __FILE__, __LINE__);
Is there a similar way where on can print out the stack trace?
Any help, hints or advice is appreciated ;-)
If all you want to know is the function call sequence (not the whole stack
contents) that has led to this situation, then there's a solution: you
create your own stack-like structure, into which you can push either a
number or a string (i.e. char*) and then pop it off. Upon entry to each
function you push that function's ID (number or string) to the stack, upon
return you pop it off. At error you just dump the contents of the stack to
stdout, stderr or elsewhere. The dump will contain the exact call
sequence...
Alex