Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
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)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions

Question

1. Television more Over watching faceing of many problems ?

Answered: 1 week ago

Question

Is there a link between chronic stress and memory function?

Answered: 1 week ago