-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File.seek() in SD library--version 1.2.2 didn't work on M0 Pro using the IDE on macOS #50
Comments
Please post a test sketch to show the problem. |
I'm at the same the point. I test it with 1.2.1 and same behaviour. However, with 1.2.0 it works. I'm not testing with M0 but with a SAMD21 compatible board.
My code is too much large to post here. I think this part of code summarize the problem. If you need something more, tell me. Thank you, best regards. |
seek() does not work indeed, if the file is opened with FILE_WRITE. But it works if the file is opened with O_WRITE instead: file = SD.open("test.txt", O_WRITE); |
Using version 1.2.0 while my requisites were solved, now, I have had to upgrade to 1.2.2 because it was solved any other problem I had with 1.2.0. Following @agrunte post and another post I could find on google, I can work with seek() function since now, but I should advice something. With this version, it seems that, when you open file with FILE_WRITE = (O_READ | O_WRITE | O_CREAT | O_APPEND), this last O_APPEND force file to write always at last position althougth you use seek() function. If you open file with only O_WRITE, if file doesn't exist previosly on SD, it will never be created and it doesn't be write. So, to work with seek() without problem, you could open file with every clause except O_APPEND.
|
Test platform: Arduino M0 Pro
I try to use the seek() function to move the write pointer to the head of a file, it didn't work. Then I change the version to 1.2.0, and it works with the same code.
The text was updated successfully, but these errors were encountered: