Thread: Writing an avi file!!Important

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Writing an avi file!!Important

    Hi EveryOne,

    I am trying to write avi file, and am having problem. The problem that i am having is that i am send each frame, size and OutputAviFile to a function... Something like this. but i have to write more the one frame to the avifile. so when a add another frame it over write the old one. is there anyway to set a postion from where i can start writing

    Code:
    void avi_add(ofstream &OutputAviFile, unsigned char *buff, int size)
    {
    	DBBREAKS db;
    	strcpy(db.db,"00db");
        db.size = size;
        OutputAviFile.write(reinterpret_cast<char *>(&db),sizeof(db));
    	OutputAviFile.write(buff,db.size);	
    }

  2. #2
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    sorta like but not really kind of yeah...

    ofstream fout (whatever.txt);

    fout<<info;

    fout.seekp(sizeof(info)+1);

    fout<<moreInfo;
    PHP and XML
    Let's talk about SAX

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    94
    When you declare the ofstream variable, make it so it appends to the file and doesn't overwrite existing data. So, you could then do this:
    Code:
    ofstream AVI_FRAME("myAviFile.avi",ios::app);// append
    avi_add(AVI_FRAME,someText,someSize);
    Hope that helps!

    Brendan
    Draco dormiens nunquam titillandus

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-20-2008, 08:57 AM
  2. Very slow file writing of 'fwrite' function in C
    By scho in forum C Programming
    Replies: 6
    Last Post: 08-03-2006, 02:16 PM
  3. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  4. help! fifo read problem
    By judoman in forum C Programming
    Replies: 1
    Last Post: 08-16-2004, 09:19 AM
  5. writing functions
    By jlmac2001 in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2003, 12:06 AM