percent.c File Reference

#include <grass/gis.h>
#include <stdio.h>

Include dependency graph for percent.c:

Go to the source code of this file.

Functions

int G_percent (int n, int d, int s)
 print percent complete messages
int G_percent2 (int n, int d, int s, FILE *out)
 print percent complete messages
int G_percent_reset (void)
 Reset G_percent() to 0%; do not add newline.


Function Documentation

int G_percent ( int  n,
int  d,
int  s 
)

print percent complete messages

This routine prints a percentage complete message to stderr. The percentage complete is (n/ total)*100, and these are printed only for each incr percentage. This is perhaps best explained by example:

  #include <stdio.h>
  int row;
  int nrows;
  nrows = 1352; // 1352 is not a special value - example only
  fprintf (stderr, ''Percent complete: '');
  for (row = 0; row < nrows; row++)
  G_percent (row, nrows, 10);
This will print completion messages at 10% increments; i.e., 10%, 20%, 30%, etc., up to 100%. Each message does not appear on a new line, but rather erases the previous message. After 100%, a new line is printed.

Parameters:
n 
total 
incr 
Returns:
int

Definition at line 51 of file percent.c.

References G_percent2().

int G_percent2 ( int  n,
int  d,
int  s,
FILE *  out 
)

print percent complete messages

This routine prints a percentage complete message to stderr. The percentage complete is (n/ total)*100, and these are printed only for each incr percentage. This is perhaps best explained by example:

  #include <stdio.h>
  int row;
  int nrows;
  nrows = 1352; // 1352 is not a special value - example only
  fprintf (stderr, ''Percent complete: '');
  for (row = 0; row < nrows; row++)
  G_percent (row, nrows, 10);
This will print completion messages at 10% increments; i.e., 10%, 20%, 30%, etc., up to 100%. Each message does not appear on a new line, but rather erases the previous message. After 100%, a new line is printed.

Parameters:
n 
total 
incr 
out print here
Returns:
int

Definition at line 84 of file percent.c.

References G_info_format(), and NULL.

Referenced by G_percent().

int G_percent_reset ( void   ) 

Reset G_percent() to 0%; do not add newline.

Returns:
int

Definition at line 135 of file percent.c.


Generated on Sun Apr 6 17:32:23 2008 for GRASS by  doxygen 1.5.5