我们知道,要求像print或rite等职能,不会立即将数据输入软盘,而是在达到门槛之前将数据进行缓冲。 我的问题是:。 我称之为“ f”功能,在寻求新职位之前,这些缓冲数据是否写上软盘? 或者,数据仍然处于缓冲状态,并写到新的位置?
理由
我们知道,要求像print或rite等职能,不会立即将数据输入软盘,而是在达到门槛之前将数据进行缓冲。 我的问题是:。 我称之为“ f”功能,在寻求新职位之前,这些缓冲数据是否写上软盘? 或者,数据仍然处于缓冲状态,并写到新的位置?
理由
我不知道缓冲区是否得到保证,如果你寻求关闭的话,它可能不会。 然而,没有办法将缓冲数据写给新职位。 缓冲只是优化,因此必须透明。
是;fseek()
确保文档按照<代码>fwrite()查询。
C标准,ISO/IEC 9899:1999 §7.19.9.2 fseek(
:
The fseek function sets the file position indicator for the stream pointed to by stream. If a read or write error occurs, the error indicator for the stream is set and fseek fails.
我并不认为,它具体规定,数据必须在<代码>fseek 上抽取,但当数据实际写成磁盘时,必须写到底是,在要求书写功能时,该溪流处于正轨。 即使数据仍然被缓冲,即使后来有人寻求,在数据变幻不定时,也可将缓冲材料写给档案的不同部分。
看来,如果你填写了fseek
,那么你的实际关切是,以前编写(但尚未变现)的数据是否会在档案中的错误位置上消失。
无。 这是你所期望的。
I have vague memories of a requirement that you call fflush
before
fseek
, but I don t have my copy of the C standard available to verify.
(If you don t it would be undefined behavior or implementation defined,
or something like that.) The common Unix standard specifies that:
If the most recent operation, other than ftell(), on a given stream is fflush(), the file offset in the underlying open file description shall be adjusted to reflect the location specified by fseek().
[......]
If the stream is writable and buffered data had not been written to the underlying file, fseek() shall cause the unwritten data to be written to the file and shall mark the st_ctime and st_mtime fields of the file for update.
This is marked as an extention to the ISO C standard, however, so you can t count on it except on Unix platforms (or other platforms which make similar guarantees).
I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...
I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?
Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...
Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?