Silly dev question: how to display internal values?

I was trying to see if I could contribute in a small way to the RT development. Not sure what this will lead to yet :slight_smile:
However, I was trying some simple stuff out and wondered what the easiest or most elegant way is to obtain the value of a certain parameter somewhere in the code.
Take for example this snippet from histogrampanel.cc:

for(int i = 0; i < 256; i++) {
if(needLuma) {
lhisttemp[i] = lhist[i];
}
(…)

the list is built up, but I would like to dump the values somewhere for inspection. How would I go about doing that?

1 Like

Hi @Thanatomanic,

I am not a dev, but if you can tolerate a real quick, dirty, and ugly swifty, insert

fprintf(stderr, “i%03d %d\n”, i, lhist[i]);

for instance just below if(needLuma) {

Compile as usual and then start Rawtherapee from a terminal.
The numbers will be shown in that terminal window.

Have fun!
Claes in Lund, Sweden

2 Likes

neither me. You can use also a debugger, here it will be gdb debugger.
see https://sourceware.org/gdb/onlinedocs/gdb/index.html#SEC_Contents

Thanks to both, that is working out well enough for my purpose :slight_smile:

Yes, fprintf is your friend. You can also replace stderr with a previously opened file handle, just don’t forget to close it later in your code. I do this a lot for large captures. Also, Windows isn’t so accommodating to fprintf when running GUI programs from the command line, so writing to the file is the primary alternative.