How can I use something like fscanf() in arduino IDE?
this is in my c code:
fscanf(File, "%d", &data->col);
How can I use something like fscanf() in arduino IDE?
this is in my c code:
fscanf(File, "%d", &data->col);
What sort of file are you trying to scan on what sort of Arduino? The answer may be very different for a file in SPIFFS on an ESP32 than it will be for an UNO with an SD card.
I am using SD card.
Ok, you answered half the question.
I am trying to read image pgm file on SD card,
image
Still missing the answer to the other half of the original question.
I got that now.
But what about:
I will wait.
I am using esp32 cam.
Not sure exactly what you want to do, but the easiest would probably be to read in line by line into a char buffer and use sscanf to parse each line.
The problem is that we don't have the same type of File object. Here your File is an instance of some SD class. fscanf doesn't know how to handle that. So you'll have to handle reading from the file separately from parsing.
sscanf() works with a string of characters, which you can read from a text file.
It will not work with any standard image file format, so please identify the correct file type.
I figured it could do whatever this line does.
If not then we would need to know something about the format of the file and exactly what the OP wants from it.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.