本文整理汇总了C++中TFileName::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileName::c_str方法的具体用法?C++ TFileName::c_str怎么用?C++ TFileName::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFileName
的用法示例。
在下文中一共展示了TFileName::c_str方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToFile
void TOrdEntryForm::SaveToFile(TFileName OrderFile)
{
ofstream DataFile;
DataFile.open(OrderFile.c_str());
TRec Temp;
for (int i=0;i<DataList->Count;i++) {
TransferFromDataList(i, Temp);
DataFile.write((char*)&Temp, sizeof(TR));
}
DataFile.close();
}
示例2: ReadFile
void TOrdEntryForm::ReadFile(TFileName OrderFile)
{
ifstream DataFile(OrderFile.c_str());
if (!DataFile) return;
// avoid painting while file is loaded
LockWindowUpdate(Handle);
while (!DataFile.read((char *)&TR, sizeof(TR)).eof()) {
AddRecord();
}
LockWindowUpdate(0);
DataFile.close();
OvcVirtualListbox1->Repaint();
OvcVirtualListbox1->ItemIndex = 0;
}
示例3: file
bool CCachedLogInfo::CCacheFileManager::ShouldDrop
( const TFileName& name
, int maxFailures)
{
// no mark -> no crash -> no drop here
if (!IsMarked (name))
{
failureCount = NO_FAILURE;
return false;
}
// can we open it?
// If not, somebody else owns the lock -> don't touch it.
HANDLE tempHandle = CreateFile ( name.c_str()
, GENERIC_READ
, 0
, 0
, OPEN_ALWAYS
, FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
, NULL);
if (tempHandle == INVALID_HANDLE_VALUE)
return false;
try
{
// any failure count so far?
CFile file (tempHandle);
if (file.GetLength() != 0)
{
CArchive stream (&file, CArchive::load);
stream >> failureCount;
}
else
{
failureCount = 0;
}
// too many of them?
CloseHandle (tempHandle);
return failureCount >= maxFailures;
}