GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
trim_dec.c
Go to the documentation of this file.
1 
17 #include <string.h>
18 #include <grass/gis.h>
19 
20 
30 int G_trim_decimal(char *buf)
31 {
32  char *mark;
33 
34  /* don't trim e+20 into e+2 */
35  if( strchr(buf, 'e') || strchr(buf, 'E') )
36  return 0;
37 
38  /* find the . */
39  while (*buf != '.')
40  if (*buf++ == 0)
41  return 0;
42 
43  mark = buf;
44  while (*++buf)
45  if (*buf != '0')
46  mark = buf + 1;
47  *mark = 0;
48 
49  return 0;
50 }
int G_trim_decimal(char *buf)
Removes trailing zeros from decimal number.
Definition: trim_dec.c:30
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
Definition: g3drange.c:62