* 프로세스 강제 종료
PS> stop-process (get-process [process_name]) -Force
예)
PS> stop-process (get-process MyApp) -Force
* GUID 생성
PS> [System.Guid]::NewGuid()
* Unzip (압축파일 풀기)
PS> Expand-Archive [zip file] -DestinationPath [unzip path]
예)
PS> Expand-Archive .\mydata.zip -DestinationPath .\mydata
* 파일 정보 보기
예)
PS> (gi .\MyApp.exe).VersionInfo | Format-List *
PS> (Get-Item .\MyApp.exe).VersionInfo | Format-List *
PS> (dir .\MyApp.exe).VersionInfo | Format-List *
* 파일을 Hex 값으로 조회
예)
PS> Format-Hex -Path "C:\example\file.txt"
'분류 전체보기'에 해당되는 글 58건
- 2025.05.16 [PowerShell 명령어 모음]
- 2018.02.05 [VIM] E575: viminfo: 줄에 이상한 시작 글자:
- 2017.08.17 size_t 타입
- 2017.03.22 CRT 라이브러리를 사용하여 메모리 누수 찾기
- 2016.12.14 시간 관련 C 함수 비교
- 2016.12.14 localtime() 과 gmtime() 사용 시 주의
- 2016.12.13 Local 시각을 GMT 시각으로 변환하는 방법
- 2016.09.21 int, unsigned int 의 hex 값 비교 (Little Endian 기준)
- 2016.09.21 VirtualBox MacOS resolution 변경 방법
- 2016.09.21 C++98 (GCC 4.2) 에서 parameter 있는 std::find_if 구현
Visual Studio 의 메모리 릭 탐지 예
Detected memory leaks!
Dumping objects ->
{810} normal block at 0x0057C3F0, 8 bytes long.
Data: < > CD CD CD CD CD CD CD CD
개발하는 Application 의 Initialize 위치에 다음 코드 추가
_CrtSetBreakAlloc(810);
time_t time(
time_t *timer
);
시스템 시간을 Unix time 으로 반환 (time_t)
struct tm *localtime(
const time_t *timer
);
Unix time (time_t) 을 년월일 시분초 형식의 구조체 (struct tm) 으로 변환.
이 때 Local time 으로 변환함.
struct tm *gmtime(
const time_t *timer
);
Unix time (time_t) 을 년월일 시분초 형식의 구조체(struct tm) 으로 변환.
이 때 UTC (=GMT) 으로 변환함.
time_t mktime(
struct tm *timeptr
);
년월일 시분초 형식의 구조체(struct tm)를 Unix time (time_t) 으로 변환함.
이 때 struct tm의 값은 Local time 으로 간주함.
Unix time ( = POSIX time, Epoch time)
1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 초로 환산하여 정수로 나타낸 것
localtime 과 gmtime 함수는 모두 struct tm * 를 반환하는데,
이 때 각 함수 호출 시 서로 반환된 struct tm * 의 값을 변경하므로 주의 해야 한다.
예)
[테스트 코드]
time_t local_time;
time ( &local_time );
struct tm *local_tm = localtime(&local_time);
// local_tm: 2016-12-14 11:33:8
struct tm *utc_tm = gmtime(&local_time);
// utc_tm: 2016-12-14 2:33:8
// local_tm: 2016-12-14 2:33:8 // 내부적으로 같은 정보를 가르키고 있어서, 값이 함께 바뀜
DebugLog("local_tm: %d-%d-%d %d:%d:%d\n",
local_tm->tm_year + 1900,
local_tm->tm_mon +1,
local_tm->tm_mday,
local_tm->tm_hour,
local_tm->tm_min,
local_tm->tm_sec);
DebugLog("utc_tm: %d-%d-%d %d:%d:%d\n",
utc_tm->tm_year + 1900,
utc_tm->tm_mon +1,
utc_tm->tm_mday,
utc_tm->tm_hour,
utc_tm->tm_min,
utc_tm->tm_sec);
[결과]
local_tm: 2016-12-14 2:33:8
utc_tm: 2016-12-14 2:33:8
// Local 시각
time_t rawtime;
time ( &rawtime );
COleDateTime localTime(rawtime);
printf("local time : %s(%lld)", localTime.Format(), rawtime);
// Local 시각 --> GMT
struct tm *gtm = gmtime(&rawtime);
time_t gt = mktime(gtm);
COleDateTime gmtTime(gt);
printf("gmt time : %s(%lld)", gmtTime(.Format(), gt);
// 결과 (예)
local time : 2016-12-13 오후 6:36:48(1481621808)
gmt time : 2016-12-13 오전 9:36:48(1481589408)
1)
(HEX) FF FF FF 7F
(INT) 2147483647
(UINT) 2147483647
2)
(HEX) FF FF FF FF
(INT) -1
(UINT) 4294967295
2)
(HEX) FE FF FF FF
(INT) -2
(UINT) 4294967294
[참고]
(MS Windows 기준) MAX 정의 (limits.h)
#define INT_MAX 2147483647 /* maximum (signed) int value */
#define LONG_MAX 2147483647L /* maximum (signed) long value */
#define LLONG_MAX 9223372036854775807i64 /* maximum signed long long int value */
[예]
struct special_compare : public std::unary_function<std::string, bool> {
explicit special_compare (const std::string& argPattern) : pattern(argPattern){}
bool operator() (const std::string& arg) {
return compare_func(arg, pattern);
}
std::string pattern;
bool compare_func(const std::string& arg, const std::string& argPattern) {
return ( std::string::npos == argPattern.find(arg) ) ? false : true;
}
};
std::vector<std::string>::iterator itr;
itr = std::find_if(keywordList.begin(), keywordList.end(), special_compare("pattern_sample"));
[참조]
C++ std::find with a custom comparator