Skip to content
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

docs: README write to file example; reminder to run file.flush() #174

Merged

Conversation

zpg6
Copy link
Contributor

@zpg6 zpg6 commented Jan 18, 2025

Adding example of writing to files in the code snippet. Includes a reminder to run file.flush() so that directory entry is updated (I has missed this resulting in #172).

let my_other_file = root_dir.open_file_in_dir("MY_DATA.CSV", embedded_sdmmc::Mode::ReadWriteCreateOrAppend)?;
my_other_file.write(b"Timestamp,Signal,Value\n")?;
my_other_file.write(b"2025-01-01T00:00:00Z,TEMP,25.0\n")?;
my_other_file.write(b"2025-01-01T00:00:01Z,TEMP,25.1\n")?;
my_other_file.write(b"2025-01-01T00:00:02Z,TEMP,25.2\n")?;

// Don't forget to flush the file so that the directory entry is updated
my_other_file.flush()?;

@thejpster thejpster marked this pull request as ready for review January 18, 2025 15:29
@thejpster
Copy link
Member

Thank you for the changes. They look good to me.

@thejpster thejpster enabled auto-merge January 18, 2025 15:30
@thejpster thejpster added this pull request to the merge queue Jan 18, 2025
Merged via the queue into rust-embedded-community:develop with commit 6ebe113 Jan 18, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants