Save frame in to binay file

Hi all!
sorry for my english… but i try!
I want to create a sort of “video guestbook”, just for learn something. :slight_smile:
I see in this forum and i try, the addons for save video in quicktime format. I try… but sometimes i have some little problem…
Anyway… this is not the problem.
I have not to save my video in right format and i want to save my video in one simple file.
I start trying to save one single frame in a file and after i try to visualize frame inside one ofTexture.
This is che code for save frame:

  
  
void VideoHandler::saveSingleFrame()  
{  
    cout << "Write file" << endl;  
    ofstream out;  
    out.open("/Users/mauroferrario/C++/of_preRelease_v0061_osxSL_FAT/apps/examples/freestyleOf/data/boh.txt",ios::binary);  
    if(!out)  
        cout<<"Cannot open output file\n";  
    out.write((char *)pixelVideo,(camWidth*camHeight*3));  
    out.close();  
}  
  

pixelVideo is one unsigned char* where i put all pixel of the frame.

and this is code for view frame:

  
  
void VideoHandler::loadSingleFrame()  
{      
    size_t   chars_read = 0;     
    ifstream is;  
    is.open("/Users/mauroferrario/C++/of_preRelease_v0061_osxSL_FAT/apps/examples/freestyleOf/data/boh.txt", ios::binary );      
    while( is && chars_read < (camWidth*camHeight*3) ) {  
        is >> pixelVideo[ chars_read ];  
        if( is )  
            ++chars_read;                 
        if( pixelVideo[ chars_read - 1 ] == '\n' )     
            break;                                      
    }      
}  
  

here in pixelVideo i put the pixel for view.

I think there is something wrong, cause i don’t see the right frame but i see… uhmmm… stranger line and color… like a stranger signal!
Any suggest for me?
Thanks!