Hi again, My program works but once i include if and else statesments i get programs. Basically I have a main (Image.c) that passes a picture based on CLA'S to another file called (Image_lib.c) which has the function to edit the image. Heres the main (Image.c) which i think the problem lies:
Code:
#include <stdio.h>
#include <ep100lib.h>
int main(int argc, char **argv)
{
ep100_lib_init();
FILE * output = stdout;
FILE * input = stdin;
char *filename=NULL;
int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y];
filename = argv[argc-1];
int count;
int width;
int height;
ep100_lib_init();
for(count=0; count<=argc-1; count++)
{
if (argc <= 1)
{
fprintf(output,"ERROR: Not enough arguments entered\n");
return(0);
}
else if (strcmp(argv[1],"-i") == 0)
{
ep100_lib_open_image(filename);
width = ep100_lib_get_image_width();
height = ep100_lib_get_image_height();
ep100_lib_get_data(image_data);
//ep100_lib_print_data(image_data);
invert_image(image_data, width, height);
ep100_lib_set_data(image_data);
sleep(2);
ep100_lib_display_image();
ep100_lib_close();
return(0);
}
}
}
Now when i remove the if...else statesments it works fine. But once i add them it doesnt.
What is wrong?