文章分类 - c++学习
分割, =两边为key和value
摘要:#include #include int main(){ char str = "a =3,b=4,c=-1,d*e=12"; char key[4] = {0}; char value[4] = {0}; const char *split = ","; char ...
阅读全文
把16进制数转为字节型存在char型数组中
摘要:把每个16进制数,存到一个字节当中。unsigned char t_row[64] = {(char)0x0,(char)0x0,(char)0x9,(char)0x0,(char)0x9,(char)0x0,(char)0x9,(char)0x0,(char)0x9,(char)0x0,(char...
阅读全文
在Android c中加log的方法
摘要://Android.mkLOCAL_SHARED_LIBRARIES := \ libz\ libcutils \ libutils//C file#define TAG "skia_png"#include #define LOGD(...) __android_log_pri...
阅读全文
在c file中打出backtrace到某个文件中
摘要:1.修改Android.mk文件在mk中所有的LOCAL_SHARED_LIBRARIES地方添加LOCAL_SHARED_LIBRARIES:=\libcutils\libutils2.在c中添加:#include #include #include #include #define NE_FOL...
阅读全文
c++几种创建对象方法总结
摘要:using namespace std;class TestNew {private: int ID;public: TestNew(int ID); ~TestNew();};TestNew::TestNew(int ID) { //this->ID = ID; cout ID << " 执行析构函数" << std::endl;}void Test() { TestNew test(1); //创建对象1,不使用new,在栈上创建,用完内存会自动释放回收 cout << "--------" <<
阅读全文
对memory的操作总结
摘要://============================================================================// Name : HelloWorld.cpp// Author : // Version :// Copyright : Your copyright notice// Description : Hello World in C++, Ansi-style//=======================================================================...
阅读全文
c++中的callstack的加法
摘要:1.#include using android::CallStack;2.... 3.CallStack stack; 4.stack.update(); 5.stack.dump("xxx");注意:此方法只适合c++,不适合c,因为c不存在这种::命名空间。
阅读全文
验证decode,encode
摘要:验证decode,把此格式的图片放到图库里面,看gallery 显示(decode)出来的是否正常。验证encode,jpg的encode用手机就能验,拍照片用hw的encode,在gallery裁剪照片然后保存成jpg是sw encode,decode验证同上。至于png和webp的encode验证,用以下程序即可:#include "SkBitmap.h"#include "SkPaint.h"#include "SkCanvas.h"#include "SkColorPriv.h"#include "
阅读全文
MFC中几种类型相互转换
摘要:1.CString -->TCHR* CString s = "XXXXX"; TCHAR filename[270]; _tcscpy(filename,bitmapPath);
阅读全文
MFC中判断文件路径
摘要:判断路径是否存在,若不存在,则创建CString namep = _T("e:\\fb\\"); if(!PathIsDirectory(namep)){ CreateDirectory(namep,NULL); //if create fail,alert message box. //MessageBox(L"Cannot create save path!", NULL, MB_OK); //return; }拼接string和int int imagenum = xxx;//变量 char* nam...
阅读全文
字串copy时,提示buffer is to small c++用法
摘要:#include "MyGame.h"#include #include #include #include int MyGame::totalparticipants = 0;int main(){ //char src[] = "1234567890"; //char src[] = "12345"; char src[] = "1234"; int len = strlen(src); //4 char dst[5]; int dlen = _countof(dst); //5 errno_t err = s
阅读全文
简易打印图形
摘要:c++ for(int i = 0; i < 10; i++) { for(int j = 0; j < 19-i; j++) { if (j < i) { cout << " "; //System.out.print(" "); } else { //if (j < 19 - 2i){ cout << "M"; //System.out.print("M"); } } cout << "\n"; }打印结果:MMMMMMMMMMMM
阅读全文
浙公网安备 33010602011771号