[SOLVED] SdFat openNext() in O_RDWR mode



I am using the sdFat library in software SPI configuration to open all the files on my SD in read & write mode using openNext(). For some reason, I am only able to open the files and read from them successfully in O_READ mode.

I tried to get the file name using getName() so that I could plug it into sdFile.open(sd.vwd(), file_name, O_RDWR), to open the file in read-write mode. But the very first time I run the function in the while( .. openNext(..)..) loop, I get “System Volume Information”. Since the file name returned by getName is “system volume information”, I get an error.

Any thoughts on how I can resolve these issues:

  1. Open a SdFile in O_RDWR mode using openNext
  2. Avoid getting the string “System Volume Information” when I run getName() for the first time.

Thanks for all the help!

[Solution that worked for me] Skip the iteration where getName yields “System Volume Information”. Use the file name to ‘remove’ it from the sd.


Thank you for putting your solution!