阅读C中的文件时不需要关闭

发布于 2025-02-11 23:50:47 字数 263 浏览 2 评论 0原文

我正在使用连接到外部内存闪光灯的ESP32,在其中安装了FATFS分区。
我不明白如果我在fopen()指令之后关闭ESP32(和flash)会发生什么。主要目的是避免被读取或写入的文件的任何损坏。
特别是我在读取文件时使用rb+参数fopen(),以及当我在上面写入时wb

在这种情况下,我可以在打开的文件上获取错误,如果发生诸如系统的不需要的开关之类的事情发生?

I'm using an ESP32 connected to an external memory flash where I mounted a FATFS partition.
I don't understand what could happen if I turn off the ESP32 (and the flash) after a fopen() instruction. The main purpose is to avoid any corruption of the file being read or written.
In particular I use a rb+ argument for the fopen() when I read the file, and a wb when I write on it.

In which case I can obtain errors on the opened file, if something such as an unwanted switch off of the system happens?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文