打印MD位图

    char md_name[60] = {0};
                
                time_t time_now = time(0) ;
                tm *local_tm = localtime(&time_now);
                sprintf(md_name, "/mnt/sda/bitmap_%02d%02d%02d.txt", local_tm->tm_hour, local_tm->tm_min, local_tm->tm_sec);

                FILE *file;
                file = fopen(md_name,"wb+");
/*
                int fd = open(md_name,O_CREAT | O_WRONLY);
                if(fd < 0)
                {
                    printf("fd:%d,open fail \n",fd);
                }

                int num = write(fd,(void *)g_out_bitmap,AV_MD_IMG_WIDTH*AV_MD_IMG_HEIGHT/8);
*/
                char *p = g_out_bitmap;
                unsigned int i,j,num=0;
                for(i=0;i<(unsigned int)240;i++)
                {
                    for(j=0;j<320;j++)
                    {
                        fprintf(file, "%d",*p);
                        p++;
                    }
                    
                    fprintf(file, "\r\n");

                    /*
                    num = write(fd,(void *)p,320/8);
                    write(fd,(void *)"\n",1);
                    p = p+320;
                    */
                }
                
                fclose(file);

你可能感兴趣的:(打印MD位图)