c - fread, fwrite for big size video file (about 180MB) -


i want read video file , save binary , write video file again. tested 180mb video. used fread function , occur segmentation fault because array size small video.

those questions:

  1. i use 160*1024 bytes char array. maximum size of char array? how can solve problem?

  2. this program need work as:

    • read 128 bytes of video -> encrypt -> write 128 byte
    • read next 128 bytes -> encrypt -> write next.

i can't upload code because of security rule of company. tip appreciated.

first use fseek() seek_end, use ftell() determine file size, after allocate needed memory malloc() , write data memory.

if understand correctly don't need allocate memory, 128 bytes.

char buf[128]; while(/* condition */) {   ret = fread(buf, sizeof buf, 1, fp_in);   encrypt(buf);   ret = fwrite(buf, sizeof buf, 1, fp_out); } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -