IT 취미생활.  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
간단한 Callback Function 예제
간단한 Callback 예제 C / C++

2007/07/28 08:35

복사 http://blog.naver.com/liezzang99/40329125

// TestCallbackFunction.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define BOOL unsigned int
#define TRUE 1
#define FALSE 0

typedef BOOL (*RonieTest_Callback)( int nValue );

typedef struct
{
 int number;
 char *name;
 RonieTest_Callback bCount_CB;
} WmMyInfo;


BOOL fnConditionCallback_cb( int nValue )
{
 BOOL bRet = 0;
 if( 0 == (nValue % 2) )
 {
   bRet = 1;
 }
 return bRet;
}


WmMyInfo *TestLoopFunction( WmMyInfo *pInfo )
{
 while(1)
 {
  pInfo->number++;
  if( pInfo->number == 10 )
  {
   BOOL bRet = pInfo->bCount_CB( pInfo->number );
   if( bRet == TRUE )
   {
    pInfo->name = new char[5];
    memset( pInfo->name, 0, sizeof(char)*5 );
    strncpy( pInfo->name, "Even", strlen("Even") );
    return pInfo;
   }

   return  pInfo;
  }
 }
}


int main(int argc, _TCHAR* argv[])
{
 WmMyInfo *pMyInfo = new WmMyInfo;
 pMyInfo->number = 0;
 pMyInfo->bCount_CB = fnConditionCallback_cb;

 pMyInfo = TestLoopFunction( pMyInfo );

 printf( "Number : %s", pMyInfo->name );


 delete []pMyInfo->name;
 delete pMyInfo;

 return 0;
}



BLOG main image
취미생활
 Notice
 Category
분류 전체보기 (191)
매일매일갱생 (83)
서버개발 (1)
임베디드개발 (12)
Programming (80)
Personal Projects (6)
유용한 프로그램 (0)
 TAGS
티스토리 초대장 debugging M480 Error Case 1seg spam mail Wince5.0 English Brazil 티스토리초대 MP3 Windows Mobile6.0 음식 isdbt DirectShow DVB Linux C 미라지폰 Algorithm DVB-T VC++ 알고리즘 벨소리 변경 영어 이메일 출장 project 군대 Debug 개발자 C++ 퇴사 Java It Dshow ISDB-T english email 서태지 warning
 Calendar
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 Recent Entries
 Recent Comments
 Recent Trackbacks
 Archive
 Link Site
zextor
괴짜 프로그래머의 일상사~@@
Gag & Peace, and more..
Kazakhstan Almaty.......
Min-A
Sadgarret
Steve Yoon's log
가슴 뛰는 삶을 살아라
오스틴 파워
GUI sin
melanie parker_Lady
제레미의 TV 2.0 이야기..
 Visitor Statistics
Total :
Today :
Yesterday :
rss