From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

Flush File 函数功能如何使用

HI  All

 

有谁用过Flush File 函数功能?

我写数据到txt,再读数据从txt,有时候读的和写入的值不一致。

网上有人说是写入缓存造成的,可以用Flush File 函数功能,

不知道此函数功能如何使用,请高人指点。

 

Best Regards

 

hoover

0 项奖励
1 条消息(共 4 条)
5,475 次查看

这个函数就是把缓存区里的数据全部写入到硬盘,防止你关闭了文件,但是有些数据还在缓存里,防止数据丢失的

0 项奖励
2 条消息(共 4 条)
5,418 次查看

防止你关闭了文件,但是有些数据还在缓存里,防止数据丢失的

That will never happen.

When you close the file, all data in the buffer will be written to the file.

No data loss.

 

George Zou
0 项奖励
3 条消息(共 4 条)
5,406 次查看

谢谢纠正

刷新文件 (函数) 使引用句柄指定文件的所有缓冲区写入磁盘,更新引用句柄相关的目录或文件。

文件继续保持打开状态,引用句柄仍有效。写入文件的数据通常位于缓冲区,直至缓冲区溢出或关闭文件。该函数强制操作系统写入缓冲数据至文件。

0 项奖励
4 条消息(共 4 条)
5,391 次查看