본문 바로가기

전체 글

[C] File I/O #include #include #include // 형식 : 이영득_2주차_파일예제.zip const int MAX_FILENAME_SIZE = 20 ; const int MAX_BUFFER_SIZE = 256 ; int main(void) { TCHAR FileName[MAX_FILENAME_SIZE] ; TCHAR InputBuffer[MAX_BUFFER_SIZE] ; ::ZeroMemory(FileName, MAX_FILENAME_SIZE* sizeof(TCHAR) ) ; ::ZeroMemory(InputBuffer, MAX_BUFFER_SIZE* sizeof(TCHAR) ) ; std::cout 더보기
[Scrap] Struct SYSTEM_INFO (*) It's from MSDN, and here is the link: http://msdn.microsoft.com/en-us/library/ms724958(VS.85).aspx SYSTEM_INFO Structure Contains information about the current computer system. This includes the architecture and type of the processor, the number of processors in the system, the page size, and other such information. Syntax C++ typedef struct _SYSTEM_INFO { union { DWORD dwOemId; struct { WORD wP.. 더보기
[C++] Function Pointer(3) (Solution) It's my solution file compressed by zip. * With finishing * Maybe, it would be last about the test code of the function pointer. Later, I'm not sure whether I'm going to write about the function pointer in my server model (because there are so many extra-informations to explain). - ps. This blog is for my English abilities, and I'm not good at communicating in English. If you see grammatic, synt.. 더보기
[C++] Function Pointer(2) (in class & with STL) * Introduction * Here is my second experience. I've often used class in C++, and I finally made it. * Function Pointer in class (code & result)*#include class cTemp1 { private : int m_X ; int m_Y ; void (cTemp1::*m_PtrF1)(void) ; int (cTemp1::*m_PtrF2)(int _x, int _y ) ; public: cTemp1(void); ~cTemp1(void); void Func1(void) ; int Func2(int _x, int _y) ; void Run() ; }; cTemp1::cTemp1(void) : m_X.. 더보기
[C++] Function Pointer(1) (Global function & using array) * Introduction * - A week ago, to parse network packets I used to do 'if' for all case. During optimizations, I turned from 'if' to 'function pointer with map'. I'm going to write about the function pointer as known as possible. * Basic usage (code) * #include void Function1() ; int Function2(int _x, int _y) ; int main() { /////////////////////////////////////////////////////////////////////////.. 더보기
Circular Buffer (Ring Buffer) (*) For the first step to implement an IOCP(Input/Output Completion Port) server model, I simply made a buffer interface to use in the server. I used a buffer which I called "pulled buffer". I'm going to show you my new Ring Buffer with the pulled buffer. * Pulled Buffer * I'd used this pulled buffer for blocking-server models. Its principle is very simple. You can easily understand this. It's assum.. 더보기
[C++] '\0' & '\n' With testing length of characters, I discovered very harm misunderstanding. I usually wrote '\n' to mean 'NULL', but it's terribly wrong. Here is my source code. * Code * #include #include #include int main() { char* Str1 = "Count." ; char* Str2 = "Count.\0" ; char* Str3 = "Count.\n" ; wchar_t* wStr1 = L"Count." ; wchar_t* wStr2 = L"Count.\0" ; wchar_t* wStr3 = L"Count.\n" ; std::cout 더보기
[Scrap] length of characters (I/O Function) (*) strlen, strlen_l, wcslen, wcslen_l, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l prototype size_t strlen( const char *str ); size_t strlen_l( const char *str, _locale_t locale ); size_t wcslen( const wchar_t *str ); size_t wcslen_l( const wchar_t *str, _locale_t locale ); size_t _mbslen( const unsigned char *str ); size_t _mbslen_l( const unsigned char *str, _locale_t locale ); size_t _mbstrlen( c.. 더보기
[Server] 쓰레드를 이용한 에코 서버 구현환경 : 비쥬얼 스튜디오 2008 구현일시 : 2009년도 초 네트워크 기반 : TCP/IP, WindowsSocketProgramming 작성자 : 이영득 설명에 들어가기 앞서, 아래 기본 에코서버에서 사용하였던 accept(), send(), recv() 함수는 우선 블럭킹 모드이다. 무슨말인고 하니, 프로그램이 진행되다가 위에 저렇게 생긴 함수안으로 들어가면 그에 상응하는 무언가가 이루어지기 이전에는 리턴되지 않는다(함수에서 빠져나오지 않는다). 자세히 설명하면, 내가 accept() 함수를 호출했다고 하자. 프로그램은 이 함수 안으로 들어간다. 그리고 상식적으로 함수안으로 들어가서 리턴이 되야 정상인데, 이놈은 리턴이 안되고 머무른다. (마치 함수안에서 무한루프를 도는것처럼) 자. 그럼 현재 .. 더보기
[Server] EventSelect 진행중 (실수로생긴 버그) Accept() 함수의 이해부족(세션메니져에 리슨소켓을 넘겼다) 기본적인 세션의 리시브, 센드의 이해부족(직접따라가보면서 해보자) 왜 서버와 클라이언트 모듈에서 리시브하는 방법이 틀린가..? - 12시간 해딩후 망가진 내 폐와 정신상태..ㅠㅠ 더보기