Advertisement
obernardovieira

Copy binary file (1024 char's/time)

Apr 20th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <ctype.h>
  2. #include <stdio.h>
  3. #define BUFSIZE 1024
  4.  
  5. int main() {
  6.     char mybuf[BUFSIZE] = { 0 };
  7.     FILE* ifd;
  8.     FILE* ofd;
  9.     ifd = fopen("test.png","rb");
  10.     ofd = fopen("out.png","wb");
  11.     while ( ( fread( mybuf, sizeof(char), BUFSIZE ,ifd) ) > 0 ) {
  12.         fwrite(mybuf, sizeof(char),BUFSIZE,ofd);
  13.     }
  14.     fclose(ifd);
  15.     fclose(ofd);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement