so im writing some video/image editing software and im stumped... not about the code so much cuz what im doing works fine .. im not convinced it is the most efficient use of my computer but it works.

first my code...

#include <iostream>
#include <fstream>

using namespace std;
int main()
     fstream obj ("sample.jpg", ios::in | ios::binary);
     fstream obj2("sample2.jpg, ios::out | ios::binary);
     int x, length;
     obj.seekg(0, ios::end);
     length = obj.tellg();
     char array[length];

      obj.seekg(0, ios::beg);

          array[x] = obj.get();



okay so my question is im not sure how jpg's or .mov's any image or movie extension is packed a way... i realize that it is a combination of 3 bytes.... so for black 3 characters would all have ffffff..

my question is where do i go to learn how these bits are packed away so i can manipulate them... any standard that would be published... (preferrably something simple but unlikely)

thank you