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);
      while(!obj.eof())
      {

          array[x] = obj.get();
          obj2.put(array[x]);          
          x++;

       };

    obj.close();
    obj2.close();
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.