This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "StdAfx.h" | |
#include "SocketServer.h" | |
#include <iostream> | |
using namespace std; | |
SocketServer::SocketServer() | |
: m_AccepterSocket(INVALID_SOCKET), | |
m_nPort(0), | |
m_dwAccepterThreadID(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "C.h" | |
std::shared_ptr<CC> CC::CreateCC(int x) | |
{ | |
return std::make_shared<CC>(CC::Key(),x); | |
} | |
CC::CC(const Key& rk, int xy) | |
{ | |
y = xy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://helloacm.com/how-to-find-out-whether-a-machine-is-big-endian-or-little-endian-in-cc/ | |
#include <stdio.h> | |
#define BIG_ENDIAN 0 | |
#define LITTLE_ENDIAN 1 | |
int TestByteOrder() { | |
short int word = 0x0001; | |
char *b = (char *)&word; | |
return (b[0] ? LITTLE_ENDIAN : BIG_ENDIAN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <string> | |
using std::map; | |
using std::string; | |
class CTeste | |
{ | |
public: | |
CTeste(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline std::string <rim(std::string &s){ | |
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); | |
return s; | |
} | |
static inline std::string &rtrim(std::string &s) { | |
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end()); | |
return s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- | |
// - Creating critical section variable - | |
// --- | |
pthread_mutex_t m; | |
// --- | |
// - Initializing - | |
//-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Syntax: | |
LONG __cdecl InterlockedCompareExchange(__inout LONG volatile *Destination, | |
__in LONG Exchange, | |
__in LONG Comparand | |
); | |
Returns the initial value of 'Destination'. | |
Note: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool CMyObj::StartThread() | |
{ | |
m_Running = true; | |
m_hThreadHandle = CreateThread(NULL,0,ThreadFunction,this,0,&this->m_ThreadID); | |
if(m_hThreadHandle == nullptr) | |
m_Running = false; | |
return m_Running | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Sync.h" | |
Sync::Sync() | |
{ | |
InitializeCriticalSection(&m_cs); | |
} | |
Sync::~Sync() | |
{ | |
DeleteCriticalSection(&m_cs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MAX using Lambda | |
std::vector<int> m_MsgTypeMaximumSize; | |
m_MsgTypeMaximumSize.push_back(7); | |
m_MsgTypeMaximumSize.push_back(5); | |
m_MsgTypeMaximumSize.push_back(20); | |
m_MsgTypeMaximumSize.push_back(1); | |
m_MsgTypeMaximumSize.push_back(3); | |
int max = 0; |
NewerOlder