2018年3月29日

摘要: #include #include #include #include #include #include //包含有uint、uchar等 #include #include using namespace std; 1.定义也是声明,extern声明不是定义,即不分配存储空间。extern告诉编译器变量在其他地方定义了。 eg:extern int a; //声明,不是... 阅读全文

posted @ 2018-03-29 22:23 yacbo 阅读(157) 评论(0) 推荐(0) 编辑

摘要: char* readFileBytes(const char *name, size_t *len) { ifstream fl(name); fl.seekg(0, ios::end); *len = fl.tellg(); char *ret = new char[*len]; fl.seekg(0, ios::beg); fl.read(re... 阅读全文

posted @ 2018-03-29 22:08 yacbo 阅读(473) 评论(0) 推荐(0) 编辑


2018年3月27日

摘要: C++中int、string等常见类型转换 1、int型与string型的互相转换 #include <string>#include <cstring>#include <iostream>#include <stdio.h>#include <stdlib.h>#include <sstream 阅读全文

posted @ 2018-03-27 19:44 yacbo 阅读(344) 评论(0) 推荐(0) 编辑


2018年3月23日

摘要: unsigned char buff1[128]={'a','b','c','d','e','f'}; //数组初始化前6位,后面默认为0 unsigned char buff2[128]={}; //数组初始化默认为0,创建数组必须初始化 memcpy(buff2,buff1+2,3); //将数组buff1内容拷贝到buff2中,buff1中第2位(0位、1位)开始的后... 阅读全文

posted @ 2018-03-23 09:02 yacbo 阅读(346) 评论(0) 推荐(0) 编辑


2018年3月5日

摘要: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include using namespace std; void main() { printf("hello ... \n"); string aa = to_string(10); cout << aa << en... 阅读全文

posted @ 2018-03-05 22:41 yacbo 阅读(208) 评论(0) 推荐(0) 编辑

摘要: 这个函数在socket中多用于清空数组.如:原型是memset(buffer, 0, sizeof(buffer)) 阅读全文

posted @ 2018-03-05 14:00 yacbo 阅读(833) 评论(0) 推荐(0) 编辑


2018年3月1日

摘要: 阅读全文

posted @ 2018-03-01 16:08 yacbo 阅读(1404) 评论(0) 推荐(0) 编辑


2018年2月6日

摘要: 1. 截取子串 s.substr(pos, n) 截取s中从pos开始(包括0)的n个字符的子串,并返回 s.substr(pos) 截取s中从从pos开始(包括0)到末尾的所有字符的子串,并返回 2. 替换子串 s.replace(pos, n, s1) 用s1替换s中从pos开始(包括0)的n个 阅读全文

posted @ 2018-02-06 15:21 yacbo 阅读(247) 评论(0) 推荐(0) 编辑


2018年1月3日

摘要: //清空相机表数据. vector::iterator iter = vec_equip_camera.begin(); for (; iter != vec_equip_camera.end();) { delete *iter; iter = vec_equip_camera.erase(iter); } for (auto it = vec_files.begin(); it ... 阅读全文

posted @ 2018-01-03 09:35 yacbo 阅读(197) 评论(0) 推荐(0) 编辑


2017年11月27日

摘要: #pragma pack(1)struct CBR{ unsigned int ip_addr; unsigned short port; unsigned short type; unsigned short length; unsigned int src; unsigned int dest; int itemsToSend; ... 阅读全文

posted @ 2017-11-27 15:07 yacbo 阅读(482) 评论(0) 推荐(0) 编辑


Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes