SD.h

hbear

Member
I'm getting the following warning in a program I wrote for Teensy 4.1 (a program I have been running under Arduino 1.8.12 for the better part of a year):

warning: large integer implicitly truncated to unsigned type [-Woverflow] in myFile = SD.open("evctrl.txt", O_WRITE | O_CREAT);

Using Arduino 1.8.12 the script compiles as usual, with absolutely no warnings when using my working Arduino IDE which resides in the standard location (Program Files (x86)) on my windows 10 machine.

With Arduino 1.8.19, I get the warning for each of the three times the SD.open function is called, using a portable Arduino IDE I just created on my external E drive.

I should also should note that exactly the same condition arises compiling with a Teensy 3.6.

So what is with #include <SD.h>?

(not sure how to include text (code is 561 lines), but not sure how this behavior is a problem with the code, as it passes Arduino 1.8.12 (Teensyduino 1.53) for multiple Teensy's but not for Arduino 1.8.19 (teensyduino 1.57)
 
Last edited:
The implementation of
Code:
SDClass::open
is expecting mode to be a uint8_t with one of the following values FILE_READ, FILE_WRITE or FILE_WRITE_BEGIN.

Look at
Code:
SDClass::open
in SD.h to see how those are mapped to the "traditional" O_ values
 
Thanks. I took a look in the library and it looks like FILE_WRITE will enable me to open and/or append (incl to a newly created file, if I'm interpreting correctly).
After replacing the constants in the three locations I opened the micro-SD files for IO with FILE_WRITE, the teensy 4.1 version of my code compiled without complaint.
 
Back
Top