GRASS Programmer's Manual 6.4.1(2011)
dig_title.c
Go to the documentation of this file.
00001 
00002 /**************************************************************
00003  * char *G_get_cell_title (name, mapset)
00004  *   char *name        name of map file
00005  *   char *mapset      mapset containing name
00006  *
00007  *   returns pointer to string containing cell title. (from cats file)
00008  *************************************************************/
00009 
00010 #include <stdio.h>
00011 #include <grass/gis.h>
00012 
00013 char *G_get_dig_title(const char *name, const char *mapset)
00014 {
00015     FILE *fd;
00016     int stat = -1;
00017     char title[100];
00018 
00019     fd = G_fopen_old("dig_cats", name, mapset);
00020     if (fd) {
00021         stat = 1;
00022         if (!fgets(title, sizeof title, fd))    /* skip number of cats */
00023             stat = -1;
00024         else if (!G_getl(title, sizeof title, fd))      /* read title */
00025             stat = -1;
00026 
00027         fclose(fd);
00028     }
00029 
00030     if (stat < 0)
00031         *title = 0;
00032     else
00033         G_strip(title);
00034 
00035     return G_store(title);
00036 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines