wwatson
Well-known member
What am I missing...
Trying to use File f.isOpen(). Not working. Am I missing something?
Sketch:
This fails to compile with:
What am I missing???
Edit: I see isOpen() in all three filesystems and FS.h
The reason for it is LittleFS is the only filesystem that does not return a bool of success or failure of closing an open file. So I was trying to do a workaround.
Trying to use File f.isOpen(). Not working. Am I missing something?
Sketch:
Code:
// Test File f.isOpen()
#ifndef diskIO_h
#define diskIO_h
#include "SD.h"
#include <USBHost_t36.h>
#include <USBHost_ms.h>
#if defined(ARDUINO_TEENSY41)
#include "LittleFS.h" // T4.1 only
#endif
#endif
File f;
void setup() {
// Open serial communications and wait for port to open:
while (!Serial);
#if defined(ARDUINO_TEENSY41)
if(CrashReport)
Serial.print(CrashReport);
#endif
if(!f.isOpen())
Serial.println("File f is not open");
}
void loop(void) {
}
This fails to compile with:
Code:
/home/wwatson/arduino-1.8.16/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10816 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_318620/pch -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SD/src -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SdFat-GPT_disks/src -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SPI -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC/src -I/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/LittleFS/src /tmp/arduino_build_318620/sketch/testisOpen.ino.cpp -o /tmp/arduino_build_318620/sketch/testisOpen.ino.cpp.o
testisOpen: In function 'void setup()':
testisOpen:24: error: 'class File' has no member named 'isOpen'
if(!f.isOpen())
^
Multiple libraries were found for "SD.h"
Used: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SD
Not used: /home/wwatson/arduino-1.8.16/libraries/SD
Using library SD at version 2.0.0 in folder: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SD
Using library SdFat-GPT_disks at version 2.1.0 in folder: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SdFat-GPT_disks
Using library SPI at version 1.0 in folder: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/SPI
Using library USBHost_t36-FS_Integration_MSC at version 0.1 in folder: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC
Using library LittleFS at version 1.0.0 in folder: /home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/LittleFS
'class File' has no member named 'isOpen'
What am I missing???
Edit: I see isOpen() in all three filesystems and FS.h
The reason for it is LittleFS is the only filesystem that does not return a bool of success or failure of closing an open file. So I was trying to do a workaround.
Last edited: