本文整理汇总了C++中FileStream::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ FileStream::Attach方法的具体用法?C++ FileStream::Attach怎么用?C++ FileStream::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileStream
的用法示例。
在下文中一共展示了FileStream::Attach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyFile
void
PostScript::ExecuteEncapsulatedPostScript (/*[in]*/ const char * lpszFileName)
{
FileStream epsStream;
unsigned start = 0;
unsigned length = 0;
#if 0
// TODO
if (bmeps_can_handle(PathName(lpszFileName).GetBuffer()) != 0)
{
tracePS->WriteFormattedLine ("libdvi", T_("Converting %s to EPS..."), Q_(lpszFileName));
epsStream.Attach (ConvertToEPS(lpszFileName));
}
else
#endif
{
epsStream.Attach (File::Open(lpszFileName, FileMode::Open, FileAccess::Read, false));
struct
{
unsigned char magic[4];
unsigned char start[4];
unsigned char length[4];
} epsfheader;
if (epsStream.Read(&epsfheader, sizeof(epsfheader)) == sizeof(epsfheader)
&& epsfheader.magic[0] == 'E' + 0x80
&& epsfheader.magic[1] == 'P' + 0x80
&& epsfheader.magic[2] == 'S' + 0x80
&& epsfheader.magic[3] == 'F' + 0x80)
{
start = epsfheader.start[0];
start += epsfheader.start[1] * 256;
start += epsfheader.start[2] * 256 * 256;
start += epsfheader.start[3] * 256 * 256 * 256;
length = epsfheader.length[0];
length += epsfheader.length[1] * 256;
length += epsfheader.length[2] * 256 * 256;
length += epsfheader.length[3] * 256 * 256 * 256;
tracePS->WriteFormattedLine ("libdvi", T_("EPS has a binary header"));
tracePS->WriteFormattedLine ("libdvi", T_("start: %u"), static_cast<unsigned>(start));
tracePS->WriteFormattedLine ("libdvi", T_("length: %u"), static_cast<unsigned>(length));
}
}
epsStream.Seek (start, SeekOrigin::Begin);
CopyFile (epsStream, length);
}