Tech & IT/프로그래밍 110

Binder 2 (Android Framework)

// froyo/external/여러분폴더/0321/binder3폴더를 만들고 myclient3.cpp로 만드세요 #include #include #include #include #include #include #include using namespace android; enum { ADD = IBinder::FIRST_CALL_TRANSACTION, SUB }; // 모든 Proxy를 만들때 공통으로 사용되는 부분은 부모로 뽑아서 사용하자. class myBpRefBase : public virtual RefBase { sp mRemote; public: myBpRefBase( const sp& binder ) : mRemote(binder) {} sp remote() const { return mRe..

C++ Template 활용(Android쪽 코드)

// intro1day.cpp : Defines the entry point for the console application. // //#include "stdafx.h" #include using namespace std; #if 0 //int_cast만드는 연습(interface cast와 비슷, 최상위 class에는 pure virtual 함수로 작성해서 //하위 class에서 강제로 toInt를 만들게 한다면 interface_cast가 될 것 class Test { public: //Test 클래스는 int값을 하나 꺼낼 수 있다고 가정해 봅시다. static int toInt() {return 10;} }; template int int_cast(T obj) { return T::toInt(..

String관련 safe함수(_s) 이용하기 (strncpy_s, sscanf_s, _snprintf)

* strncpy, strncpy_s에 대한 오해 풀기 (strncpy_s에서 size설정시 설정size보다 넘어가면 안전하게 size안까지만 copy하는 것이 아님, size가 넘어가게 되면 Error를 띄우라는 의미임) http://gpgstudy.com/forum/viewtopic.php?p=97501 * strcpy, sscanf, sprintf 대신 safe함수(_s) 이용하기 http://doubleyh.tistory.com/entry/strcpy-sscanf-sprintf-대신하여-안전한-프로그램-짜기 1. strcpy은 strncpy, strncpy_s를 사용한다. 참고 : http://msdn.microsoft.com/ko-kr/library/5dae5d43.aspx Example> ch..