아래 처럼 Visual Studio 2008 에서
솔류션 탐색기에 현재 편집중인 파일위치를 알수 있게 해준다.
지인 사이트 KeyTol 블로그 에서 발췌하였다^^

옵션은 아래를 참고^^
솔류션 탐색기에 현재 편집중인 파일위치를 알수 있게 해준다.
지인 사이트 KeyTol 블로그 에서 발췌하였다^^

옵션은 아래를 참고^^
[하프]초미지향 님 Mabinogi Server CheckUp 1.2 소스 참고 했습니다.
한국 본서버 기준 :
http://211.218.233.238/patch/patch.txt
파일 중에
patch_accept 값이 1 이면 게임 접속이 가능하다
patch_accept=1
테스트 서버 URL
http://211.218.233.238/patch/patch_test.txt
C/C++로 구현한다면
Socket으로 211.218.233.238 80번 포트로 연결후
"GET /patch/patch.txt HTTP/1.0\r\n\r\n" 을 보내고(send)
결과값을 받는다 (recv)
class LogTest_Task : public ACE_Task<ACE_NULL_SYNCH> { typedef ACE_Task<ACE_NULL_SYNCH> super; private: ACE_Log_Msg_Callback * m_pLogCallback; public: LogTest_Task( ACE_Log_Msg_Callback * logCallback ) : super(), m_pLogCallback( logCallback ) { } virtual int svc() { if( m_pLogCallback ) { ACE_LOG_MSG->set_flags( ACE_Log_Msg::MSG_CALLBACK ); ACE_LOG_MSG->clr_flags( ACE_Log_Msg::STDERR ); ACE_LOG_MSG->msg_callback( m_pLogCallback ); } // Log 출력. ACE_DEBUG( ( LM_DEBUG, ACE_TEXT("DEBUG hello World") ) ); ACE_ERROR( ( LM_ERROR, ACE_TEXT("ERROR hello World") ) ); return 0; } };
// Task생성및 Task 실행. LogTest_Task logTask( ACE_Log_Msg::instance()->msg_callback() ); logTask.activate(); logTask.wait();
BOOL CACE_MFCApp::InitInstance() { ..... ///////////////////////////////////////////////////////////////// // 추가 WORD wVersionRequested; WSADATA wsaData; int err = 0; wVersionRequested = MAKEWORD( 2, 2 ); if( WSAStartup( wVersionRequested, &wsaData ) != 0 ) return FALSE; ACE::init(); ///////////////////////////////////////////////////////////////// CACE_MFCDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } ///////////////////////////////////////////////////////////////// // 추가 ACE::fini(); WSACleanup( ); ///////////////////////////////////////////////////////////////// // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
#include <time.h> #include <iostream> #include <Windows.h> using namespace std; int main() { cout << "http://fehead.tistory.com/" << endl; for( ;; ) { time_t now = time( 0 ); // 자정(오늘의 0시 시각을 구함) struct tm todayStartTm; localtime_s( &todayStartTm, &now ); todayStartTm.tm_sec = 0; todayStartTm.tm_min = 0; todayStartTm.tm_hour = 0; // 자정부터 현재까지 지난 초를 구함 time_t todayTotalSec = now - mktime( &todayStartTm ); // 에린의 현재 누적된 분(Min)을 구함. // (에린시간은 1.5초당 1분이 지나기 때문에 1.5로 나누었음.) time_t erinTotalMin = static_cast<time_t>( todayTotalSec / 1.5 ); // 에린의 하루 시간을 구함. // 누적된 시간에서 오늘로부터 지난 시간을 구함(24 * 60 - 하루) time_t erinTodayMin = erinTotalMin % (60*24); time_t erinHour = erinTodayMin / 60; // 에린시간 시 time_t erinMin = erinTodayMin % 60; // 에린시간 분 cout << erinHour << " : " << erinMin << endl; // 시간 출력 Sleep( 1000 ); } return 0; }
// DirectoryZip --- c:\tmp 디렉토리를 c:\tmp.zip 으로 압축 CZipper zip; if (zip.OpenZip("c:\\tmp.zip", false)) zip.AddFolderToZip("c:\\tmp", false); // FileZip --- c:\tmp\test.txt 파일을 c:\tmp.zip 으로 압축 CZipper zip; if (zip.OpenZip("c:\\tmp.zip", false)) zip.AddFileToZip("c:\\tmp\\text.txt", false); // Unzip --- c:\tmp.zip 을 c:\tmp에 압축해제 CUnzipper uz; bool br = uz.OpenZip("c:\\tmp.zip"); if(br) br = uz.UnzipTo("c:\\tmp");
아래 샘플 코드의 실행 방법은 인자를 붙여 실행합니다. ZipUnzip.exe c C:\tmp ==> c:\tmp 디렉토리를 압축하여 c:\tmp.zip 파일을 만든다. ZipUnzip.exe d C:\tmp ==> c:\tmp.zip 파일을 압축해제하여 c:\tmp에 압축을 푼다.
/* dostime.c - routines for converting UNIX time to MS-DOS time. Borrowed from Info-zip's unzip Copyright (C) 1999 Bryan Burns This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: dostime.c,v 1.3 2001/09/17 20:35:55 zlaski Exp $ $Log: dostime.c,v $ Revision 1.3 2001/09/17 20:35:55 zlaski Resolve conflicts due to 2001-09-12 FSF import. Revision 1.2 2000/12/14 18:45:35 ghazi Warning fixes: * compress.c: Include stdlib.h and compress.h. (rcsid): Delete. (report_str_error): Make static. (ez_inflate_str): Delete unused variable. Add parens in if-stmt. (hrd_inflate_str): Likewise. * compress.h (init_compression, end_compression, init_inflation, end_inflation): Prototype void arguments. * dostime.c (rcsid): Delete. * jargrep.c: Include ctype.h, stdlib.h, zlib.h and compress.h. Make functions static. Cast ctype function argument to `unsigned char'. Add parens in if-stmts. Constify. (Usage): Change into a macro. (jargrep): Remove unused parameter. * jartool.c: Constify. Add parens in if-stmts. Align signed/unsigned char pointers in functions calls using casts. (rcsid): Delete. (list_jar): Fix printf format specifier. (usage): Chop long string into bits. Reformat. * pushback.c (rcsid): Delete. Revision 1.1 2000/12/09 03:08:23 apbianco 2000-12-08 Alexandre Petit-Bianco < apbianco@cygnus.com > * fastjar: Imported. Revision 1.1.1.1 1999/12/06 03:09:12 toast initial checkin.. Revision 1.6 1999/05/10 08:32:26 burnsbr added dos2unixtime Revision 1.5 1999/04/27 10:03:50 burnsbr configure support Revision 1.4 1999/04/26 21:55:19 burnsbr switched from sys/time.h to time.h for better portability Revision 1.3 1999/04/20 08:54:30 burnsbr added GPL comment Revision 1.2 1999/04/20 05:10:53 burnsbr added RCS tags */ #include "config.h" #ifdef TM_IN_SYS_TIME #include < sys/time.h > #else #include < time.h > #endif #include "dostime.h" /* Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly, Kai Uwe Rommel, Onno van der Linden and Igor Mandrichenko. Permission is granted to any individual or institution to use, copy, or redistribute this software so long as all of the original files are included, that it is not sold for profit, and that this copyright notice is retained. */ time_t dos2unixtime(dostime) unsigned long dostime; /* DOS time to convert */ /* Return the Unix time_t value (GMT/UTC time) for the DOS format (local) * time dostime, where dostime is a four byte value (date in most * significant word, time in least significant word), see dostime() * function. */ { struct tm *t; /* argument for mktime() */ time_t clock = time(NULL); t = localtime(&clock); t->tm_isdst = -1; /* let mktime() determine if DST is in effect */ /* Convert DOS time to UNIX time_t format */ t->tm_sec = (((int)dostime) << 1) & 0x3e; t->tm_min = (((int)dostime) >> 5) & 0x3f; t->tm_hour = (((int)dostime) >> 11) & 0x1f; t->tm_mday = (int)(dostime >> 16) & 0x1f; t->tm_mon = ((int)(dostime >> 21) & 0x0f) - 1; t->tm_year = ((int)(dostime >> 25) & 0x7f) + 80; return mktime(t); } unsigned long dostime(y, n, d, h, m, s) int y; /* year */ int n; /* month */ int d; /* day */ int h; /* hour */ int m; /* minute */ int s; /* second */ /* Convert the date y/n/d and time h:m:s to a four byte DOS date and time (date in high two bytes, time in low two bytes allowing magnitude comparison). */ { return y < 1980 ? dostime(1980, 1, 1, 0, 0, 0) : (((unsigned long)y - 1980) << 25) | ((unsigned long)n << 21) | ((unsigned long)d << 16) | ((unsigned long)h << 11) | ((unsigned long)m << 5) | ((unsigned long)s >> 1); } unsigned long unix2dostime(t) time_t *t; /* unix time to convert */ /* Return the Unix time t in DOS format, rounded up to the next two second boundary. */ { time_t t_even; struct tm *s; /* result of localtime() */ t_even = (*t + 1) & (~1); /* Round up to even seconds. */ s = localtime(&t_even); /* Use local time since MSDOS does. */ return dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday, s->tm_hour, s->tm_min, s->tm_sec); }
#include < sys/types.h > #include < utime.h > int utime(const char *filename, const struct utimbuf *times);
#include < sys/types.h > #include < utime.h > #include < sys/time.h > #include < stdio.h > #include < string.h > int main() { struct utimbuf ubuf; ubuf.actime = time((time_t *)0); ubuf.modtime = time((time_t *)0); // 접근,수정 시간을 현재 시간으로 변경한다. utime("sizeof.c", NULL); // NULL 대신 actime,modtime 을 세팅해서 // 직접 값을 지정해줄수도 있다. utime("sizeof.c", &ubuf); return 0; }
virtual int handle_data() { while( log_record() != -1 ) { if( m.acquire() == -1 ) return 0; ++request_count; // 요청개수 증가 m.release(); // 잠금해제 } m.acquire(); int cnt = request_count; m.release(); cout << "request_count" = " << cnt << endl; }
virtual int handle_data() { while( log_record() != -1 ) { // 생성자에서 잠금 획득 ACE_GUARD_RETURN ( ACE_Thread_Mutex, guard, m , -1 ); ++request_count; // 요청개수 증가 // 소멸자에서 잠금 해제. } { // 생성자에서 잠금 획득 ACE_GUARD_RETURN ( ACE_Thread_Mutex, guard, m , -1 ); int cnt = request_count; // 소멸자에서 잠금 해제. } cout << "request_count" = " << cnt << endl; }