文章分类 -  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 ... 阅读全文
posted @ 2015-01-30 15:02 snowdrop 阅读(182) 评论(0) 推荐(0)
把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... 阅读全文
posted @ 2014-10-19 17:02 snowdrop 阅读(4753) 评论(0) 推荐(0)
在Android c中加log的方法
摘要://Android.mkLOCAL_SHARED_LIBRARIES := \ libz\ libcutils \ libutils//C file#define TAG "skia_png"#include #define LOGD(...) __android_log_pri... 阅读全文
posted @ 2014-05-27 14:22 snowdrop 阅读(488) 评论(0) 推荐(0)
在c file中打出backtrace到某个文件中
摘要:1.修改Android.mk文件在mk中所有的LOCAL_SHARED_LIBRARIES地方添加LOCAL_SHARED_LIBRARIES:=\libcutils\libutils2.在c中添加:#include #include #include #include #define NE_FOL... 阅读全文
posted @ 2014-05-26 17:41 snowdrop 阅读(677) 评论(0) 推荐(0)
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 << "--------" << 阅读全文
posted @ 2014-02-11 20:51 snowdrop 阅读(1191) 评论(0) 推荐(0)
对memory的操作总结
摘要://============================================================================// Name : HelloWorld.cpp// Author : // Version :// Copyright : Your copyright notice// Description : Hello World in C++, Ansi-style//=======================================================================... 阅读全文
posted @ 2014-02-10 16:46 snowdrop 阅读(248) 评论(0) 推荐(0)
c++中的callstack的加法
摘要:1.#include using android::CallStack;2.... 3.CallStack stack; 4.stack.update(); 5.stack.dump("xxx");注意:此方法只适合c++,不适合c,因为c不存在这种::命名空间。 阅读全文
posted @ 2013-12-20 16:23 snowdrop 阅读(939) 评论(0) 推荐(0)
验证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 " 阅读全文
posted @ 2013-08-14 14:52 snowdrop 阅读(421) 评论(0) 推荐(0)
MFC中几种类型相互转换
摘要:1.CString -->TCHR* CString s = "XXXXX"; TCHAR filename[270]; _tcscpy(filename,bitmapPath); 阅读全文
posted @ 2013-08-07 11:16 snowdrop 阅读(192) 评论(0) 推荐(0)
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... 阅读全文
posted @ 2013-08-05 16:43 snowdrop 阅读(376) 评论(0) 推荐(0)
字串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 阅读全文
posted @ 2013-07-09 19:42 snowdrop 阅读(518) 评论(0) 推荐(0)
简易打印图形
摘要: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 阅读全文
posted @ 2013-05-08 10:57 snowdrop 阅读(278) 评论(0) 推荐(0)