[GRASS-SVN] r35750 - grass-addons/raster/mcda/r.roughset
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Feb 3 16:39:12 EST 2009
Author: gianluca
Date: 2009-02-03 16:39:12 -0500 (Tue, 03 Feb 2009)
New Revision: 35750
Modified:
grass-addons/raster/mcda/r.roughset/rules_extr.c
Log:
fix bug for big sys files
Modified: grass-addons/raster/mcda/r.roughset/rules_extr.c
===================================================================
--- grass-addons/raster/mcda/r.roughset/rules_extr.c 2009-02-03 19:45:15 UTC (rev 35749)
+++ grass-addons/raster/mcda/r.roughset/rules_extr.c 2009-02-03 21:39:12 UTC (rev 35750)
@@ -254,10 +254,10 @@
FILE *fp; /*file pointer for ASCII output*/
/* open *.sys file for writing or use stdout */
- if(NULL == (fp = fopen(file_out_sys, "w")))
+ if(NULL == (fp = fopen(file_out_sys, "w")))
G_fatal_error("Not able to open file [%s]",file_out_sys);
- fprintf(fp,"NAME: %s\nATTRIBUTES: %d\nOBJECTS: %s\n",file_out_sys,nattribute+1," ");
+ fprintf(fp,"NAME: %s\nATTRIBUTES: %d\nOBJECTS: %s\n",file_out_sys,nattribute+1," ");
/************** process the data *************/
@@ -283,7 +283,7 @@
G_trim_decimal (cell_buf);
fprintf (fp,"%s ",cell_buf);
}
- fprintf(fp,"%d \n",decvalue);
+ fprintf(fp,"%d\n",decvalue);
nobject++;
}
}
@@ -299,11 +299,10 @@
/************** write header file*************/
- if(0<fseek(fp,0L,0)) /*move file pointer to header file*/
- G_fatal_error("Not able to write file [%s]",file_out_sys);
- else
- fprintf(fp,"NAME: %s\nATTRIBUTES: %d\nOBJECTS: %d\n",file_out_sys,nattribute+1,nobject);
+ rewind(fp); /*move file pointer to header file*/
+ /* TODO: make a system to detect errors like: G_fatal_error("Not able to write file [%s]",file_out_sys);*/
+ fprintf(fp,"NAME: %s\nATTRIBUTES: %d\nOBJECTS: %d",file_out_sys,nattribute+1,nobject);
/************** close all and exit ***********/
fclose(fp);
More information about the grass-commit
mailing list