?? mos.cpp
字號:
#include "MCRT/mos.h"
#ifdef WIN32
# include <direct.h>
#else //! WIN32
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/select.h> // for select time wait on Posix System
# include <unistd.h>
#endif //end WIN32
#include <time.h>
#include <errno.h>
mInt32 MOS::mkdir( const char* pPath )
{
if ( pPath == NULL )
{
return E_PARAM_POINTER_NULL;
}
#ifdef WIN32
int retVal = ::mkdir( pPath );
#else //! WIN32
int retVal = ::mkdir( pPath, 0755 ); //use default
#endif //end WIN32
if ( (retVal != 0) && (errno != EEXIST) )
{
return E_GENERAL;
}
return E_SUCCESS;
}
/**
* @brief unlink
*
* @param[in] pPath file path to be delete
* @return E_SUCCESS \n
* E_PARAM_POINTER_NULL
*/
mInt32 MOS::unlink( const char* pPath )
{
if ( pPath == NULL )
{
return E_PARAM_POINTER_NULL;
}
::unlink( pPath );
return E_SUCCESS;
}
char* MOS::timestamp( char* bufDateTime, mUInt32 lenBuf )
{
time_t nowClock;
tm* nowTime = NULL;
::time( &nowClock );
nowTime = ::localtime( &nowClock );
::strcpy( bufDateTime, ::asctime(nowTime) );
return bufDateTime;
}
mInt32 MOS::sleep( mUInt32 nMilliSeconds )
{
#ifdef WIN32
::Sleep( nMilliSeconds );
#else //! WIN32
timeval timeout;
timeout.tv_sec = nMilliSeconds / 1000;
timeout.tv_usec = (nMilliSeconds % 1000) * 1000;
::select( 0, 0, 0, 0, &timeout );
#endif //end WIN32
return E_SUCCESS;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -