GRASS Programmer's Manual  6.4.2(2012)
trim_dec.c
Go to the documentation of this file.
00001 
00017 #include <string.h>
00018 #include <grass/gis.h>
00019 
00020 
00030 int G_trim_decimal(char *buf)
00031 {
00032     char *mark;
00033 
00034     /* don't trim e+20 into e+2 */
00035     if( strchr(buf, 'e') || strchr(buf, 'E') )
00036         return 0;
00037 
00038     /* find the . */
00039     while (*buf != '.')
00040         if (*buf++ == 0)
00041             return 0;
00042 
00043     mark = buf;
00044     while (*++buf)
00045         if (*buf != '0')
00046             mark = buf + 1;
00047     *mark = 0;
00048 
00049     return 0;
00050 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines