c/c++ 日常积累

基类是抽象类,有(纯)虚函数,子类必须要把所有的都实现啊啊啊!!!!包括子类的析构,你写一个~xx类 = default;也好啊啊啊啊啊啊啊,不然报错!!!!啊啊啊啊啊

 流下了悔恨的泪水!!!。。。

大小端,联合体

#include <stdio.h>
#include <stdbool.h>

union
{
  short i;
  char x[2];
} a;

bool IsBigEndian()
{
  union NUM
  {
    int a;
    char b;
  }num;
  num.a = 0x1234;
  if( num.b == 0x12 )
  {
    return true;
  }
  return false;
}

int main(int argc, char* argv[]) {

  a.x[0] = 10;//0000 1010  高数据
  a.x[1] = 1; //0000 0001  低数据

  //在内存中的排列方式(PC默认小端):
  //低地址 --> 高地址
  //高数据 --> 低数据
  //0000 0001  0000 0001

  printf("%d
", a.i);
  printf("%x
", a.i);

  printf("%d
", IsBigEndian());

  printf("%lu
", sizeof(int));

  union test1
  {
    int a;
    char b;
    char c;
  } test1;
  printf("%lu
", sizeof(union test1));

  union test2
  {
    int a;
    char b;
    long e
  } test2;
  printf("%lu
", sizeof(union test2));



  return 0;
}

Linux struct itimerval用法

https://blog.csdn.net/hbuxiaofei/article/details/35569229

网络编程的三个重要信号(SIGHUP ,SIGPIPE,SIGURG)

https://blog.csdn.net/z_ryan/article/details/80952498

Linux 守护进程的原理与实现

https://www.cnblogs.com/zhangming-blog/articles/5946797.htm

c++容器的底层数据结构

https://www.cnblogs.com/smallredness/p/11069489.html

c 联合体和结构体区别

https://blog.csdn.net/sjtudou/article/details/81074916

linux下 监控USB插入事件

 https://blog.csdn.net/bytxl/article/details/49759527

Netlink 内核实现分析(一):创建

https://blog.csdn.net/luckyapple1028/article/details/50839395

C与C++混合编程+编译

https://blog.csdn.net/lv_Amelia/article/details/79483481

#ifndef _READERDLL_H
#define _READERDLL_H

#ifdef WIN32

#ifdef DLL_EXPORTS
#define DLL_API  extern "C" __declspec(dllexport)
#else//DLL_EXPORTS

#ifdef __cplusplus
#define DLL_API extern "C" __declspec(dllimport)
#else//__cplusplus
#define DLL_API
#endif//__cplusplus

#endif//DLL_EXPORTS

#else//WIN32

#ifdef __cplusplus
#define DLL_API extern "C"
#else
#define DLL_API
#endif //__cplusplus

#endif//WIN32
DLL_API void CVR_LogSwitch(bool flag);

DLL_API int CVR_GetSAMID(char *SAMID, int *length);

DLL_API int CVR_GetStatus();

DLL_API int CVR_InitComm(const char *path, int protocolType);

DLL_API int CVR_CloseComm();

DLL_API int CVR_Authenticate();

DLL_API int CVR_AuthenticateForNoJudge();

DLL_API int CVR_Read_Content(int active);

DLL_API int CVR_Read_FPContent(int active);

DLL_API int CVR_FindCard ();

DLL_API int CVR_SelectCard();

DLL_API int CVR_AnalysisCardInfo(unsigned char *infoBuff, int infoLen);

DLL_API int GetPeopleName(char *strTmp, int *strLen);

DLL_API int GetPeopleSex(char *strTmp, int *strLen);

DLL_API int GetPeopleNation(char *strTmp, int *strLen);

DLL_API int GetPeopleBirthday(char *strTmp, int *strLen);

DLL_API int GetPeopleIDCode(char *strTmp, int *strLen);

DLL_API int GetDepartment(char *strTmp, int *strLen);

DLL_API int GetStartDate(char *strTmp, int *strLen);

DLL_API int GetEndDate(char *strTmp, int *strLen);

DLL_API int GetCertType (unsigned char * strTmp, int *strLen);

DLL_API int GetFPDate (unsigned char *pData, int * pLen);

DLL_API int GetPeopleAddress (char *strTmp, int *strLen);

DLL_API int GetPassCheckID(char *strTmp, int *strLen);

DLL_API int GetIssuesNum(char *strTmp, int *strLen);

DLL_API int GetBMPData (unsigned char *pData, int * pLen);

DLL_API int GetPeopleChineseName(char *strTmp, int *strLen);

DLL_API int GetPeopleCertVersion(char *strTmp, int *strLen);

DLL_API int ID_GetInfo(int nPortNo, char* extendPort, int nBaudRate, int nTimeout, char* szPhotoHead,
                      char* szPhotoFace, char* szPhotoBack, char* szPhotoCard,char* szIdentityInfo);

DLL_API int CVR_MF_HL_Request(unsigned char nMode, unsigned int  *pSNR, unsigned short *pTagType);

DLL_API int CVR_MF_HL_Write(unsigned char  nMode, unsigned int nSNR, unsigned char nBlock,
                           unsigned char nKey[6], unsigned char *pWriteBuff, unsigned int nBuffLen);

DLL_API int CVR_MF_HL_Read(unsigned char  nMode, unsigned int nSNR, unsigned char nBlock,
                          unsigned char nKey[6], unsigned char *pReadBuff, unsigned int *pBuffLen);


#endif//_READERDLL_H

ISO C++11 does not allow conversion from string literal to 'char *'

c++ 11不允许从字符串到char *的转换

char *timez = "CCT-08:00";
改为
char *timez = (char*)"CCT-08:00";

mysql占用CPU超过100%解决过程

https://www.jianshu.com/p/7f7d3c04d609

http://www.voidcn.com/article/p-vuqpnjil-bkg.html

原文地址:https://www.cnblogs.com/kongweisi/p/14684642.html