Test if the file was opened properly (and don’t forget to close it)
Does the program crash or just continues happily ?
Do you actually have something in the file?
Give us a full code exhibiting the issue that compiles - your problem may be elsewhere like too many open file descriptors or no more memory for your String (how big is that file that you try to suck into your String object?)
J-M-L:
Test if the file was opened properly (and don’t forget to close it)
Does the program crash or just continues happily ?
Do you actually have something in the file?
Give us a full code exhibiting the issue that compiles - your problem may be elsewhere like too many open file descriptors or no more memory for your String (how big is that file that you try to suck into your String object?)
You STILL haven't answered the question. How big is the file? If you think you can read a 2 terabyte file into the 2K of memory that the Arduino has, while having a file open, and swiss-cheesing memory using the String class, think again.
PaulS:
You STILL haven't answered the question. How big is the file? If you think you can read a 2 terabyte file into the 2K of memory that the Arduino has, while having a file open, and swiss-cheesing memory using the String class, think again.
So, you KNOW how big the file is. Why do you need to do dynamic memory allocation, then? Just allocate a char array big enough to hold the complete file, and fill it in one call to read().