View Full Version : printing a line?
EscapeCharacter
04-01-2002, 11:03 PM
is there a function that will print the line its on? something that could be used in debugging or would i just have to put the line in manually?
Hmm... I think programs would have to be compiled with special debugging info to allow that. VisualC++ can do such things, though I don't know if they provide an interface or function to allow you do manuallly print a line out.
sans-hubris
04-02-2002, 01:43 PM
In VisC++, you have to make sure the Debug option is flagged, but I am not in front of a computer with VisC++ right now to be able to tell you where that option is. It shouldn't be too difficult to find though.
With gcc, make sure you compile with the -g option. Then, you can debug your program with gdb. If you want a really nice interface to gdb, check out Data Display Debugger (DDD) (http://www.gnu.org/software/ddd/), the best debugging tool I've yet used. I don't think you can find one better than DDD.
if you want help getting visual c++ to do it, you can ask. I use it all day. It should be as easy as making sure the select box in the build toolbar (if that toolbar isn't visible, right click an empty spot on the toolbar to add it) is set to win32 debug and running the debugger (f5)
EscapeCharacter
04-02-2002, 08:31 PM
Originally posted by kmj
if you want help getting visual c++ to do it, you can ask. I use it all day. It should be as easy as making sure the select box in the build toolbar (if that toolbar isn't visible, right click an empty spot on the toolbar to add it) is set to win32 debug and running the debugger (f5)
unfortunately this app uses straight xlib so that wont be very helpful too me, this is off topic but kmj have you gotten qt working with vc++ yet?
ah, no... I forgot about it. sorry. I've had my hands in too many pots lately. I really do want to get it working, but sometimes my eyes are bigger then my stomache... err, well, my ambitions are longer than my days or whatever. you get the point.
EscapeCharacter
04-02-2002, 10:24 PM
understandable :)
PrBacterio
05-18-2002, 07:24 AM
This is ANSI standard C code:
#include<stdio.h>
int main()
{
printf("file %s line #%d\n", __FILE__, __LINE__);
return 0;
}
EscapeCharacter
06-03-2002, 04:16 AM
beautiful thanks dude, even works in c++ including iostream
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.