本文整理汇总了C++中COutFileStream::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ COutFileStream::Open方法的具体用法?C++ COutFileStream::Open怎么用?C++ COutFileStream::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COutFileStream
的用法示例。
在下文中一共展示了COutFileStream::Open方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main2
int main2(int n, const char *args[])
{
if (strcmp(args[n - 1], "-notitle") == 0)
n--;
else {
fprintf(stderr,
"\nt5lzma 1.00 Copyright (C) 2004 H.Kawai\n"
" --- based : LZMA 4.03 Copyright (c) 1999-2004 Igor Pavlov 2004-06-18\n"
);
}
if (n == 1)
{
PrintHelp();
return 0;
}
if (sizeof(Byte) != 1 || sizeof(UInt32) < 4 || sizeof(UInt64) < 4)
{
fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile");
return 1;
}
UStringVector commandStrings;
WriteArgumentsToStringList(n, args, commandStrings);
CParser parser(kNumSwitches);
try
{
parser.ParseStrings(kSwitchForms, commandStrings);
}
catch(...)
{
IncorrectCommand();
}
if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs)
{
PrintHelp();
return 0;
}
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
int paramIndex = 0;
if (paramIndex >= nonSwitchStrings.Size())
IncorrectCommand();
const UString &command = nonSwitchStrings[paramIndex++];
if (command.CompareNoCase(L"b") == 0)
{
UInt32 dictionary = 1 << 21;
if(parser[NKey::kDictionary].ThereIs)
{
UInt32 dicLog;
if (!GetNumber(parser[NKey::kDictionary].PostStrings[0], dicLog))
IncorrectCommand();
dictionary = 1 << dicLog;
}
const UInt32 kNumDefaultItereations = 10;
UInt32 numIterations = kNumDefaultItereations;
{
if (paramIndex < nonSwitchStrings.Size())
if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations))
numIterations = kNumDefaultItereations;
}
return LzmaBenchmark(numIterations, dictionary);
}
bool encodeMode;
if (command.CompareNoCase(L"e") == 0)
encodeMode = true;
else if (command.CompareNoCase(L"d") == 0)
encodeMode = false;
else
IncorrectCommand();
bool stdInMode = parser[NKey::kStdIn].ThereIs;
bool stdOutMode = parser[NKey::kStdOut].ThereIs;
CMyComPtr<ISequentialInStream> inStream;
CInFileStream *inStreamSpec = 0;
if (stdInMode)
{
inStream = new CStdInFileStream;
MY_SET_BINARY_MODE(stdin);
}
else
{
if (paramIndex >= nonSwitchStrings.Size())
IncorrectCommand();
const UString &inputName = nonSwitchStrings[paramIndex++];
inStreamSpec = new CInFileStream;
inStream = inStreamSpec;
if (!inStreamSpec->Open(GetSystemString(inputName)))
{
fprintf(stderr, "\nError: can not open input file %s\n",
(const char *)GetOemString(inputName));
return 1;
}
}
//.........这里部分代码省略.........