【发布时间】:2013-11-11 16:14:39
【问题描述】:
假设我制作了一个名为“lotsofdata”的长字符串,然后使用以下代码输出其内容:
string outputFilePath = @"C:\output.txt";
System.IO.File.WriteAllText(outputFilePath, lotsofdata);
SpecialFunction1();
SpecialFunction2();
SpecialFunction3();
我的问题是,在继续运行 SpecialFunction1 之前,计算机是否完全完成了将所有内容写入 output.txt 的操作?或者,它是否启动输出过程并在输出过程完成之前移动到 SpecialFunction1?
我之所以问,是因为我想确保 output.txt 在继续进行 SpecialFunction1() 之前已完成写入,但我不知道如何确保这一点。
【问题讨论】: