Hello there,

I'm trying to read a jpeg pixel and then compare it if it'x bigger than a number to change it.
either I'm breaking the folder if I start less than 22000 which is very large number shouldn't include the header or I'm getting solid color without any different.

Code:
const char* filename ="Hydrangeas.JPG";
		const char* nfilename ="Hydrangeas1.JPG";

		FILE  *ptr_old, *ptr_new;
		errno_t err = 0, err1 = 0;
		int a;

		err = fopen_s(&ptr_old, filename, "rb");
		err1 = fopen_s(&ptr_new, nfilename, "wb");

		if(err != 0){
			cout<<"can't find it"<<endl;
			return  -1;
			fclose(ptr_old);
		}
		if (err1 !=0)
		{
			cout<<"can't find it"<<endl;
			return  -1;
			fclose(ptr_old);
		}
		
		
		 int o = 0;
		 while (1)
		 {
			 a = fgetc(ptr_old);
			 
			 if (a>=0)
			 {
				 if (o>30000)
				{
				//	cout<<a<<" : ";
					if (a>90){
						a=0;
					}else{
						a=255;}
				//cout<<a<<endl;
				}
				// cout<<a<<endl;
				 fputc(a,ptr_new);
			 }else{
				break;
			 }
			 o++;
		 }
		 
		
		fclose(ptr_new);
		fclose(ptr_old);
		return  0;
}