Commit eeb23774 authored by saeed's avatar saeed

file exist is added

parent e9a53fb0
time gcc -std=c99 -O2 rita.c -o odbview -lX11 -lm -lpthread
time gcc -Wall -std=c99 -O2 rita.c -o odbview -lX11 -lm -lpthread
......@@ -11,4 +11,4 @@
#define oceancolor 0xffffffff
#define landcolor 0x91919191
#define stncolor 0x00bf0000
#define landseamask_file "/home/a002066/odbview/landseamask.bin"
#define landseamask_file "landseamask.bin"
......@@ -8,7 +8,14 @@ static int run_view(int argc,char *argv[]){
}
if (argc >= 2 ){
if (!file_exist(landseamask_file)){
printf("file %s does not exist so we quit \n",landseamask_file);
result = 1;
return result;
}
int width = WIDTH_INIT;
int height = HEIGHT_INIT;
int ncolor = 0;
......
static int file_exist(char *filename){
int result = 0;
if (filename){
FILE *file = fopen(filename,"r");
if (file){
result = 1;
fclose(file);
}
}
return result;
}
static float getradius(int w, int h, struct screen_dim *scdim){
float result = (float)(((float)(w *h)/ (float)(scdim->width * scdim->height)) * scdim->symbol_radius);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment