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 "gis.h"
00010 
00011 
00026 char *
00027 G_get_cell_title (name, mapset)
00028     char *name;
00029     char *mapset;
00030 {
00031     FILE *fd;
00032     int stat;
00033     char title[1024];
00034 
00035     stat = -1;
00036     fd = G_fopen_old ("cats", name, mapset);
00037     if (fd)
00038     {
00039         stat = 1;
00040         if (!fgets(title, sizeof title, fd))   /* skip number of cats */
00041             stat = -1;
00042         else if (!G_getl(title, sizeof title, fd))      /* read title */
00043             stat = -1;
00044 
00045         fclose (fd);
00046     }
00047 
00048     if (stat < 0)
00049         *title = 0;
00050     else
00051         G_strip (title);
00052     return G_store(title) ;
00053 }

Generated on Sat Jul 22 22:06:14 2006 for GRASS by  doxygen 1.4.7