本文整理汇总了C++中FileStream::Interrupt方法的典型用法代码示例。如果您正苦于以下问题:C++ FileStream::Interrupt方法的具体用法?C++ FileStream::Interrupt怎么用?C++ FileStream::Interrupt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileStream
的用法示例。
在下文中一共展示了FileStream::Interrupt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test
void SuiteFileStream::Test()
{
const TUint kBytes = 256;
Bws<kBytes> b;
// Populate each position in the buffer with it's index.
for (TUint i=0; i<kBytes; i++) {
b.Append((TChar)i);
}
FileBrx f(b);
FileStream stream;
stream.SetFile(&f);
TEST(stream.Bytes() == kBytes);
// test basic reading
Bws<kBytes> buf;
stream.Read(buf);
TEST(buf == b);
TEST(stream.Tell() == kBytes);
// test that reads on a full buffer and at the end of a file throw
TEST_THROWS(stream.Read(buf), ReaderError);
buf.SetBytes(0);
TEST_THROWS(stream.Read(buf), ReaderError);
// test seeking
stream.Seek(0);
TEST(stream.Tell() == 0);
// test a stream can be (un)interrupted
stream.ReadInterrupt();
Bws<10> buf2;
TEST_THROWS(stream.Read(buf2), ReaderError);
stream.Interrupt(false);
stream.Read(buf2);
TEST(buf2.Bytes() == buf2.MaxBytes());
for (TUint i=0; i<10; i++) {
TEST(buf2[i] == b[i]);
}
// test that Read appends to a buffer
buf.SetBytes(0);
buf.Append(buf2);
stream.Read(buf);
TEST(buf.Bytes() == kBytes);
TEST(buf == b);
}