[ale] gcc programming

Geoffrey esoteric at 3times25.net
Sat Jan 22 21:58:45 EST 2005


ringo wrote:
> Is this a good forum for asking programming questions or is there a
> better one for gcc?
> I don't have my C book on me and I need to print debug info to a text
> file. Does anyone have a code snippet ob how to open a file and print to
> it?

This is probably as good a place as any I suspect.

You'll likely want to write the debug info to standard error and capture.

Here's how I do it in C so that I can track where the data was spit out:

(void)fprintf(stderr, "%s %d: %s\n", __FILE__, __LINE__, debugdata);

Then when you run your program, do this:

program 2> program.err

-- 
Until later, Geoffrey



More information about the Ale mailing list