cell_title.c

Go to the documentation of this file.
00001 /**************************************************************
00002  * char *G_get_cell_title (name, mapset)
00003  *   char *name        name of map file
00004  *   char *mapset      mapset containing name
00005  *
00006  *   returns pointer to string containing cell title. (from cats file)
00007  *************************************************************/
00008 
00009 #include <grass/gis.h>
00010 
00011 
00026 char *
00027 G_get_cell_title  (char *name, char *mapset)
00028 
00029 {
00030     FILE *fd;
00031     int stat;
00032     char title[1024];
00033 
00034     stat = -1;
00035     fd = G_fopen_old ("cats", name, mapset);
00036     if (fd)
00037     {
00038         stat = 1;
00039         if (!fgets(title, sizeof title, fd))   /* skip number of cats */
00040             stat = -1;
00041         else if (!G_getl(title, sizeof title, fd))      /* read title */
00042             stat = -1;
00043 
00044         fclose (fd);
00045     }
00046 
00047     if (stat < 0)
00048         *title = 0;
00049     else
00050         G_strip (title);
00051     return G_store(title) ;
00052 }

Generated on Fri Nov 21 11:02:17 2008 for GRASS by  doxygen 1.5.1