File in binary form

Posted by Abhi on Stack Overflow See other posts from Stack Overflow or by Abhi
Published on 2010-03-28T07:40:02Z Indexed on 2010/03/28 7:43 UTC
Read the original article Hit count: 212

Filed under:
|
|

Dear All

I want to write data into the file in binary form.

I was trying using the mentioned below

FILE *fp = fopen("binaryoutput.rgb888", "ab+");

for(int m=0; m<height; m++)
{
   for (int n=0; n< width; n++)        
   {                            
    temp = (pOutputImg+m*3+n*3); // here temp is a pointer to a unsigned char   
    fprintf(fp,"%u",*temp);             
   }        
}
fclose(fp);

I am able to get data which is strored at pOutputImg but not in binary form.

Can anyone guide me the correct step..

Thanks in advance

© Stack Overflow or respective owner

Related posts about binary

Related posts about file