Advertisement
shouhei

Line

Nov 19th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. //Decralation of variables
  6. FILE *fpi1,*fpi2,*fpo;
  7. int id,ix,iy,i,j,width,height;
  8. float x,y,z;
  9. unsigned char dn;
  10. unsigned char *buffer1;
  11. unsigned char *buffer2;
  12. unsigned char r,g,b;
  13.  
  14. //Open CSV file
  15. if((fpi1=fopen(argv[1],"rb"))==NULL)
  16. {
  17. printf ("The file can't be opened. The program is exit.\n");
  18. return 0;
  19. }
  20.  
  21. fread((unsigned char*)buffer1,sizeof(char),width*height*3,fpi1);
  22.  
  23. if((fpi2=fopen(argv[2],"rb"))==NULL)
  24. {
  25. printf ("The file can't be opened. The program is exit.\n");
  26.  
  27. return 0;
  28. }
  29.  
  30. r=atoi(argv[6]);
  31. g=atoi(argv[7]);
  32. b=atoi(argv[8]);
  33.  
  34. time=atoi(argv[9]);
  35.  
  36. width = atoi(argv[4]); printf("W = %d,", width);
  37. height = atoi(argv[5]); printf("H = %d\n", height);
  38.  
  39. buffer1= (unsigned char*)malloc(width*height*3);
  40.  
  41.  
  42. fread((unsigned char*)buffer1,sizeof(char),width*height*3,fpi1);
  43. fread((unsigned char*)buffer2,sizeof(char),width*height*3,fpi2);
  44.  
  45.  
  46. if((fpo=fopen(argv[3],"wb"))==NULL)
  47. {
  48. printf("The file can't be opened. The program is exit.\n");
  49.  
  50. return 0;
  51. }
  52.  
  53. imeco[i*2+j]
  54.  
  55. buffer[3*(iy*width+ix)]=r;
  56. buffer[3*(iy*width+ix)+1]=g;
  57. buffer[3*(iy*width+ix)+2]=b;
  58.  
  59.  
  60. fclose(fpi1);
  61. fclose(fpi2);
  62. fclose(fpo);
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement