On Tue, 21 May 2002 16:43:54 +0800
"henry" <[EMAIL PROTECTED]> wrote:

> Dear List :
> 
> I am a gcc newbie.
> A kind member of list taught me use 
> "fprintf(stderr,"file:%s  line:%d  function:%s", __FILE__,__LINE__,__FUNCTION__) ; "
> to print message of currently_running_code (which file ? which line ? which function 
>?) .

The file, line and function name printed will be the file, line and function of 
the fprintf statement.

>  How do I print those trace_messages 
> on screen after execution of the program
> (attentation: my program is a VGA-program) ? 

Since your program is a VGA mode program, the best way to get this data is
to print to a file instead of stderr. You will need to open the file
first using fopen() ie

     file = fopen ("error_output.txt", "w") ;
     if (file == NULL)
          exit (1) ;

and then do:

    fprintf (file, "file:%s  line:%d  function:%s", __FILE__,__LINE__,__FUNCTION__) ;

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
+-----------------------------------------------------------+
Running MS-Windows on a Pentium is like having a brand new Porsche 
but only being able to drive backwards with the handbrake on.
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to