函数'int fcloseFILE *'的参数太少

问题描述

您好,我是微处理器C语言的初学者。我想读取一个“ .bmp”文件,以便对其应用行检测。我已经声明了读取图像的功能。按下编译按钮时会发生此错误:

#include "esp_camera.h"
#include "Arduino.h"
#include "FS.h"                // SD Card ESP32
#include "SD_MMC.h"            // SD Card ESP32
#include "soc/soc.h"           // Disable brownour problems
#include "soc/rtc_cntl_reg.h"  // Disable brownour problems
#include "driver/rtc_io.h"
#include <EEPROM.h>            // read and write from flash memory
#include <SPI.h>

  void imageReader(const char *imgName,int *height,int *width,int *bitdepth,unsigned char *header,unsigned char *_colortable,unsigned char *buf
    ) // READ AN IMAGE
  {
     int i;
     fs::FS &fs = SD_MMC;  // 
     FILE *file;
     file = fopen(imgName,"rb"); // read imgName file ( it is a picture in .bmp format )
     if(!file){
        Serial.printf("Unable to read image");
     }
     for(i=0 ; i<54 ; i++){
        header[i]=getc(file);
     }
     *width = *(int * )& header[18]; // width information of the image
     *height = *(int * )& header[22]; // height information of image
     *bitdepth = *(int *)& header[28];
     if(*bitdepth<=8){
        fread(_colortable,sizeof(unsigned char),1024,file);
     }
     fread(buf,( 1600 * 1200 ),file);
     fclose();
    }

出现此错误。函数'int fclose(FILE *)'的参数太少

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)