[GRASS-dev] Re: G_percent()

Martin Landa landa.martin at gmail.com
Thu Jun 12 04:25:15 EDT 2008


Hamish,

2008/6/12 Hamish <hamish_b at yahoo.com>:
> just some tips re G_percent()
>
> - put it at the end of the loop not the beginning.
>
> say the iteration takes very long per step. if you put it at the very start it instantly says "3% done" the first time you call it then stalls on 100% done while the last iteration is executed.
>
> - usually you will have to call it a final time after the for loop to get the "100% done" and newline to be printed. This depends on how you write your i++ for loop of course, but typically if you don't the number stalls a 99% without newline.

thanks, I forgot about this. I fixed my last commit in devbr6 and
trunk [1]. I didn't call G_percent() after the loop, AFAIU in this
case it is not needed -- for (line=1, line <= nlines; line++) --
otherwise final 100% is printed twice.

Martin

[1] http://trac.osgeo.org/grass/changeset/31686

-- 
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *


More information about the grass-dev mailing list