1.Android.mkLOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)#LOCAL_MULTILIB := 32LOCAL_SRC_FILES := print-log.cppLOCAL_MODULE := print-logLOCAL_MODULE_TAGS := optinalLOCAL_SHARED_LIBRARIES := liblog libutilsinclude $(BUILD_EXECUTABLE)2.print-log.cpp#include #include #include #undef NDEBUG#undef LOG_TAG#define LOG_TAG "print_log"#define LOG_MAX 1024static void print_str(std::string buffer, char *func, int line){  int len = buffer.length();  int start = 0;  int end = LOG_MAX;  ALOGE("xxx---starting------->%s(), line = %d, len = %d",func,line,len);   for(int i = 0; i < 100; i++){    if(len > end){      //linux log      //cout << buffer.substr(start, LOG_MAX) << endl;      //android log      ALOGE("%s(): data[%d] = %s",__FUNCTION__,i,buffer.substr(start, LOG_MAX).c_str());      start = end;      end = end + LOG_MAX;    }else{      //linux log      //cout <%s(), line = %d, len = %d",func,line,len); }int main(){  char *parameters = "12345611111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444412345611111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444412345611111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444412345611111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444412345611111111111111111111111111111111111111";    //const char * ----> string:两种方式  //1.  std::string buffer(parameters);  //2.  //buffer = parameters;   print_str(buffer,"main",__FUNCTION__);  ALOGE("xxx---------->%s(), line = %d",__FUNCTION__,__LINE__);    return 0;}

 

更多相关文章

  1. Android更新UI的五种方式
  2. Android关于桌面快捷方式工具类!
  3. Android菜单实现两种方式
  4. 我今天的面试题,注册广播有几种方式,这些方式有何优缺点?请谈谈Andr
  5. Android 代码设置Color的几种方式
  6. Android控件隐藏方式 .
  7. Android客户端与服务端交互-客户端GET方式登录和客户端POST方式
  8. Android获取存储卡路径的方式

随机推荐

  1. 使用Android内置httpRequest发起httpRequ
  2. android CVE 漏洞汇总
  3. Android(安卓)Widget桌面组件创建
  4. SharedPreferences 数据存储
  5. Android(安卓)关闭软键盘
  6. Android获取系统当前时区
  7. android webview实现拍照
  8. 【Android】Native RTL support in Andro
  9. Android_通过传感器抓小偷
  10. 如何在G1上安装非android market的apk