File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ int main( int argc, char **argv )
108
108
rast_type = G_get_raster_map_type ( fd );
109
109
cell = G_allocate_c_raster_buf ();
110
110
dcell = G_allocate_d_raster_buf ();
111
+ void * ptr ;
112
+ double val ;
111
113
112
114
if ( rast_type == CELL_TYPE )
113
115
{
@@ -116,7 +118,8 @@ int main( int argc, char **argv )
116
118
G_fatal_error (( "Unable to read raster map <%s> row %d" ),
117
119
rast_opt -> answer , row );
118
120
}
119
- fprintf ( stdout , "value:%d\n" , cell [col ] );
121
+ val = cell [col ];
122
+ ptr = & (cell [col ]);
120
123
}
121
124
else
122
125
{
@@ -125,7 +128,16 @@ int main( int argc, char **argv )
125
128
G_fatal_error (( "Unable to read raster map <%s> row %d" ),
126
129
rast_opt -> answer , row );
127
130
}
128
- fprintf ( stdout , "value:%f\n" , dcell [col ] );
131
+ val = dcell [col ];
132
+ ptr = & (dcell [col ]);
133
+ }
134
+ if ( G_is_null_value ( ptr , rast_type ) )
135
+ {
136
+ fprintf ( stdout , "value:null\n" );
137
+ }
138
+ else
139
+ {
140
+ fprintf ( stdout , "value:%f\n" , val );
129
141
}
130
142
}
131
143
G_close_cell ( fd );
You can’t perform that action at this time.
0 commit comments