本文整理汇总了C++中SetFile函数的典型用法代码示例。如果您正苦于以下问题:C++ SetFile函数的具体用法?C++ SetFile怎么用?C++ SetFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocalTime
void Log::ReallyPrint(LPCTSTR format, va_list ap)
{
SYSTEMTIME current;
GetLocalTime(¤t);
if (memcmp(&m_lastLogT, ¤t, sizeof(SYSTEMTIME)) != 0)
{
m_lastLogT = current;
TCHAR time_str[50] = {0};
TCHAR date_str[50] = {0};
int nRet = GetDateFormat(LOCALE_USER_DEFAULT, NULL, ¤t, TEXT("dd"), date_str, sizeof(date_str));
nRet = GetTimeFormat(LOCALE_USER_DEFAULT,NULL, ¤t,TEXT("hh:mm:ss"),time_str,sizeof(time_str));
TCHAR time_buf[50];
wsprintf(time_buf, TEXT("<%s %s>:"),date_str, time_str);
ReallyPrintLine(time_buf);
}
// Prepare the complete log message
TCHAR line[LINE_BUFFER_SIZE];
memset(line, 0, sizeof(line));
int len = 0;
#ifdef _UNICODE
_vsnwprintf(line, sizeof(line) - 2 * sizeof(TCHAR), format, ap);
len = wcslen(line);
#else
_vsnprintf(line, sizeof(line) - 2 * sizeof(TCHAR), format, ap);
len = strlen(line);
#endif // _UNICODE
line[LINE_BUFFER_SIZE-2] = (TCHAR)'\0';
#if (!defined(_UNICODE) && !defined(_MBCS))
if (len > 0 && len <= sizeof(line) - 2 * sizeof(TCHAR) && line[len-1] == (TCHAR)'\n') {
// Replace trailing '\n' with MS-DOS style end-of-line.
line[len-1] = (TCHAR)'\r';
line[len] = (TCHAR)'\n';
line[len+1] = (TCHAR)'\0';
}
#endif
ReallyPrintLine(line);
ReallyPrintLine(TEXT("\r\n"));
//if overfollow create new log
if (m_tofile)
{
nTotalLogWrited += len;
//max log size = 10m
if (nTotalLogWrited > 1024*1024*10)
{
CloseFile();
CString strNewFile = m_strOrgFileName;
SetFile(strNewFile, false);
}
}
}
示例2: CHTTPFileHandler
CHTTPImageHandler::CHTTPImageHandler(const HTTPRequest &request)
: CHTTPFileHandler(request)
{
std::string file;
int responseStatus = MHD_HTTP_BAD_REQUEST;
// resolve the URL into a file path and a HTTP response status
if (m_request.pathUrl.size() > 7)
{
file = m_request.pathUrl.substr(7);
XFILE::CImageFile imageFile;
const CURL pathToUrl(file);
if (imageFile.Exists(pathToUrl))
{
responseStatus = MHD_HTTP_OK;
struct __stat64 statBuffer;
if (imageFile.Stat(pathToUrl, &statBuffer) == 0)
{
SetLastModifiedDate(&statBuffer);
SetCanBeCached(true);
}
}
else
responseStatus = MHD_HTTP_NOT_FOUND;
}
// set the file and the HTTP response status
SetFile(file, responseStatus);
}
示例3: SetFile
void cElCompileFN::MakeFileH(bool SpecFCUV)
{
SetFile("h",0);
(*this) << "class " << mNameClass << ": public cElCompiledFonc\n";
(*this) << "{\n";
(*this) << " public :\n\n";
(*this) << " " << mNameClass << "();\n";
(*this) << " void ComputeVal();\n";
(*this) << " void ComputeValDeriv();\n";
(*this) << " void ComputeValDerivHessian();\n";
(*this) << " double * AdrVarLocFromString(const std::string &);\n";
for (cECFN_SetString::const_iterator it = mNamesLoc->begin(); it!=mNamesLoc->end() ; it++)
{
(*this) << " void Set"<< it->Name() << "(double);\n";
}
(*this) << "\n\n";
(*this) << " static cAutoAddEntry mTheAuto;\n";
(*this) << " static cElCompiledFonc * Alloc();\n";
(*this) << " private :\n\n";
{
for (cECFN_SetString::const_iterator it = mNamesLoc->begin(); it!=mNamesLoc->end() ; it++)
{
(*this) << " double "<<NameVarLoc(it->Name()) <<";\n";
}
}
(*this) << "};\n";
CloseFile();
}
示例4: m_endianness
NzFile::NzFile(const NzString& filePath) :
m_endianness(nzEndianness_Unknown),
m_impl(nullptr),
m_openMode(0)
{
SetFile(filePath);
}
示例5: Save
bool TDocument::AllowClose()
{
if (IsModified())
{
bool save;
if (!TCommonDialogs::SaveChanges(fTitle, GetMainWindow(), save))
return false;
if (save)
{
// save the file
if (fFile.IsSpecified())
Save();
else
{
TFile* file = TCommonDialogs::SaveFile(NULL, GetMainWindow());
if (file)
{
SetFile(file);
Save();
delete file;
}
else
return false;
}
}
}
return true;
}
示例6:
std::unique_ptr<Workspace> JsonImporter::ImportWorkspace(FileManager& fileManager, const filesystem::path& workspaceFile)
{
auto json = internal::ParseJsonFile(fileManager.GetFileSystem(), workspaceFile);
if (internal::IsValidWorkspace(json))
{
auto workspace = std::make_unique<Workspace>();
workspace->SetName(json["workspace"]);
workspace->SetFile(workspaceFile);
auto& projects = json["projects"];
if (projects.is_array())
{
auto workspacePath = workspaceFile.parent_path();
for (auto& project : projects)
{
workspace->AddProject(ImportProject(fileManager, workspacePath / project));
}
}
return workspace;
}
return nullptr;
}
示例7: SetName
// be careful.. it can go through recursion.
// do not use AssignVar, SetVar.. and so on.
// which makes to run this function again.
// these functions gets argment with the CVar type...
// and calls this function again.
CVar::CVar(CVar &var)
{
value = 0;
file = NULL;
string = NULL;
var_name = NULL;
cbr = var.cbr;
var_type = var.var_type;
SetName(var.var_name);
next = var.next;
prev = var.prev;
switch(var_type)
{
case INT :
case CHAR : SetValue(var.value);
break;
case STRING : SetString(var.string);
break;
case File : SetFile(var.file);
break;
default : sntx_err(INTERNAL_ERROR);
}
}
示例8: SetFile
Log::Log(int mode, int level, char *filename, bool append)
{
m_lastLogTime = 0;
m_filename = NULL;
m_append = false;
hlogfile = NULL;
m_todebug = false;
m_toconsole = false;
m_tofile = false;
SetFile(filename, append);
SetMode(mode);
SetLevel(level);
// If the compiler returns full path names in __FILE__,
// remember the path prefix, to remove it from the log messages.
char *path = __FILE__;
char *ptr = strrchr(path, '\\');
if (ptr != NULL) {
m_prefix_len = ptr + 1 - path;
m_prefix = (char *)malloc(m_prefix_len + 1);
memcpy(m_prefix, path, m_prefix_len);
m_prefix[m_prefix_len] = '\0';
}
}
示例9: SetUserAdded
void ImageResource::UnserializeFrom(const SerializerElement & element)
{
alwaysLoaded = element.GetBoolAttribute("alwaysLoaded");
smooth = element.GetBoolAttribute("smoothed");
SetUserAdded( element.GetBoolAttribute("userAdded") );
SetFile(element.GetStringAttribute("file"));
}
示例10: ArpD
status_t ArpConfigureFile::SetFile(const char* name)
{
ArpD(cdb << ADH << "ArpConfigureFile: setting file from path = "
<< name << endl);
BEntry entry(&mFile);
if( entry.InitCheck() != B_OK ) return entry.InitCheck();
BPath path;
status_t err = entry.GetPath(&path);
if( err != B_OK ) return err;
ArpD(cdb << ADH << "ArpConfigureFile: orig path = "
<< path << endl);
err = path.InitCheck();
if( err == B_OK ) err = path.GetParent(&path);
if( err == B_OK ) err = path.Append(name);
ArpD(cdb << ADH << "ArpConfigureFile: renamed path = "
<< path.Path() << endl);
if( err != B_OK ) return err;
entry.SetTo(path.Path());
err = entry.InitCheck();
if( err != B_OK ) return err;
entry_ref ref;
err = entry.GetRef(&ref);
if( err != B_OK ) return err;
return SetFile(ref);
}
示例11: memcpy
BOOL ringFile::CreateTemp(LPCTSTR prefix)
{
char path[MAX_PATH];
char name[MAX_PATH];
char pfix[4];
// 合成前缀串
if(prefix)
{
memcpy((void*)pfix,(const void *)prefix, 3);
pfix[3] = '\0';
}
else
wsprintf(pfix,"RFT\0");
// 获得临时文件全路径
GetTempPath(MAX_PATH,path);
GetTempFileName((LPCSTR)path,(LPCSTR)pfix,0,(LPSTR)name);
if (strlen((char*)name) == 0)
return FALSE;
// 进行预关联
SetFile((LPCTSTR)name);
// 进行实关联
return Create(RF_NEW,FILE_ATTRIBUTE_TEMPORARY);
}
示例12: SetFile
CFileLock::CFileLock(const char* p_szFile)
{
m_nFd = -1;
m_szFile = NULL;
if (p_szFile)
{ SetFile(p_szFile);
}
}
示例13: U8Archive
U8NandArchive::U8NandArchive( const char* nandPath )
: U8Archive( NULL, 0 ),
fd( -1 ),
dataOffset( 0 )
{
if( nandPath )
{
SetFile( nandPath );
}
}
示例14: CHTTPFileHandler
CHTTPWebinterfaceHandler::CHTTPWebinterfaceHandler(const HTTPRequest &request)
: CHTTPFileHandler(request)
{
// resolve the URL into a file path and a HTTP response status
std::string file;
int responseStatus = ResolveUrl(request.pathUrl, file);
// set the file and the HTTP response status
SetFile(file, responseStatus);
}
示例15: U8Archive
U8FileArchive::U8FileArchive( const char* filePath )
: U8Archive( NULL, 0 ),
fd( NULL ),
dataOffset( 0 )
{
if( filePath )
{
SetFile( filePath );
}
}