How to write a C Program to Create a copy of an image in C Programming Language ?
- #include<stdio.h>
- #include<stdbool.h>
- #include<stdlib.h>
- typedef FILE image;
- int main(void)
- {
- image *img1 = NULL,*img2 = NULL;
- int value = 0;
- img1 = fopen("c:/users/coder/desktop/abcd.jpg","rb");
- img2 = fopen("c:/users/coder/desktop/hello.jpg","wb");
- if(img1 == NULL)
- {
- perror("File Not Found");
- return EXIT_FAILURE;
- }
- while((value=getw(img1))!=EOF)
- {
- fwrite(&value,4,1,img2);
- }
- fclose(img1);
- fclose(img2);
- return EXIT_SUCCESS;
- }