Question: Hi! I was coding C++, and I ran into 5 errors. Can you please help me correct them.. Attached code and errors. 1 #include 2
Hi! I was coding C++, and I ran into 5 errors. Can you please help me correct them..
Attached code and errors.
1 #include 2 #include 3 #include 4 #include 5 6 typedef wint8_t BYTE; 00 #define BLOCK_SIZE 512 9 #define FILE_NAME_SIZE 8 10 bool is_start_new_jpeg(BYTE buffer ); 11 int main(int argc, char *argv) 12 { 13 if (argc != 2) 14 15 printf("Usage: ./recover image\\"); 16 return 1; 17 18 FILE* infile - fopenCargv[1], "r"); 19 if (infile = NULL) 20 21 printf("File not found\\"); 22 return 1; 2324 25 BYTE buffer [BLOCK_SIZE] ; 26 int file_index = 0; 27 bool have_found_first_jpg = false; 28 FILE* outfile; 29 while (fread(buffer, BLOCK_SIZE, 1, infile)) 30 { 31 if (is_start_new_jpeg(buffer)) 32 33 if (!have_found_first_jpg) 34 have_found_first_jpg = true; 35 else 36 fclose(outfile); 37 38 char filename [FILE_NAME_SIZE] ; 39 sprintf(filename, "*03i. jpg", file_index++); 40 outfile = fopen(filename, "w"); 41 if (outfile == NULL) 42 return 1; 43 fwrite(buffer, BLOCK_SIZE, 1, outfile); 44 45 46 else if (have_found_first_jpg) 47 48 keep on writing the previous file 49 fwrite(buffer, BLOCK_SIZE, 1, outfile); 50\f\frecover. c:53:3: error: type specifier missing, defaults to 'int' [-Werror, -Wimplicit-int] fclose(outfile) ; Arecover. C:53:10: error: a parameter list without types is only allowed in a function definition fclose(outfile) ;recover. c:54:3: error: type specifier missing, defaults to 'int' [-Werror, -Wimplicit-int] fclose (infile);recover. c:54:10: error: a parameter list without types is only allowed in a function definition fclose(infile)