Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm trying to rotate a bitmap with the command line but i keep getting a segmentation fault(core dumped) error. It works if i don't use
I'm trying to rotate a bitmap with the command line but i keep getting a segmentation fault(core dumped) error. It works if i don't use the command line. Thanks in advance for the help.
int main(int argc, char *argv[]) { extern char *optarg; extern int optind; int degree=0, scale=0,ferror=0; int is_rotate=0, is_scale=0, is_flip=0; //char *inputFile=NULL, *outputFile=NULL; int r, c; PIXEL *b, *nb; readFile("example.bmp",r,c,nb); while((c=getopt(argc,argv,"r:")) != -1) { switch (c) { case 'r': is_rotate=1; rotate(b,r,c,atoi(optarg),&b,&r,&c); free(b); free(nb); break; } } // int r, c; // PIXEL *b, *nb; //readFile("example.bmp", &r, &c, &b); flip(b, &nb, r, c); // rotate(b, r,c,-270,&nb,&r,&c); writeFile("result.bmp", r, c, nb); //enlarge(b,r,c,1000000,&nb,&r,&c); free(b); free(nb); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started