C++ quick sort 퀵 정렬 void quickSort(vector& nums, int l, int r) { if (l >= r) return; int mid = partition(nums, l, r); quickSort(nums, l, mid); quickSort(nums, mid + 1, r); } int partition(vector& nums, int l, int r) { int pivot = nums[l]; while (l = pivot) r--; nums[l] = nums[r]; while (l < r && nums[l]
Win32에서 IPC(Inter Process Communication)의 하나의 방법인 Pipe에 관한 간단한 Server/Client 예제이다.파이프를 하나만 만들고 단방향 서버 클라이언트이다.서버는 보내기만 하고, 클라이언트는 받기만 한다. // PipeServer2.cpp : Defines the entry point for the console application.//#include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]){ // "\\\\.\\pipe\\RenToImaging"라는 이름의 파이프를 생성한다. // 파이프는 항상 \\.\pipe\(이름)에 생성 되어야 한다. HANDLE hPipe = ::CreateNamedPipe(L"\\\\.\\..
Target중에서 외부에서 사용하는 것은 Build, Rebuild, Clean이 있는데 이것을 커스터마이즈하는 가장 쉬운 방법은 BuildDependsOn, RebuildDependsOn, CleanDependsOn이라는 property를 다음과 같이 수정해 주면된다. 아래의 예제에서는 전체 BuildDependsOn Target을 수행하기전에 DependsBuild라는 Target을 먼저 수행한후에 하라는 예제이다. DependsBuild는 물론 로 정의되어야 한다. DependsBuild;$(BuildDependsOn); DependsClean;$(CleanDependsOn); 내부의 Build과정에 대해서는 수많은 복잡한 Import되는 MSBuild에서 제공하는 props와 targets가 있지..
MSBuild 4.0에서는 프로퍼티(그러니까 문자열)에 대해서 함수를 호출하여 특정 기능을 수행할수 있다.예를 들어 문자열을 substring한다던가 하는 기능을 task를 따로 만들지 않고서도 가능하다.특정 네임스페이스에서 호출할 때는 다음과 같이 한다.$([Namespace.Type]::Method(..parameters…))$([Namespace.Type]::Property)$([Namespace.Type]::set_Property(value)) 그리고 특정 프로퍼티에 대한 호출은 다음과 같이 한다.$(property.Method(..parameters...))$(property.Property)$(property.set_Property(value)) http://blogs.msdn.com/b/vi..
MSBuild 4.0에서 C++용 MSBuild 스크립트를 다루다 보면 다음 두가지의 프로퍼티 변수가 자주 나온다. 예를들어 Microsoft.Cpp.targets를 import할때 $(VCTargetPath)에서 import하는데 그 프로퍼티는 레지스트리에 저장되어 있으며 그 값은 다음과 같다. 이렇게 분리한 이유는 VCTargetPath는 Visual Studio 2010을 설치하면 생기는 C++전용 targets 파일들이고, MSBuildToolsPath에는 C++,C#등 공통적은 targets가 들어있다. 이 프로퍼티들은 import되는 targets를 분석하는데에는 알고있는 것이 유용하다. 왜냐하면 소스를 볼 일이 생길수도 있다. $(VCTargetPath)C:\Program Files (x86..
- Total
- Today
- Yesterday