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. Duplicate files copied (Android(安卓)Studio)
  3. Android:HttpURLConnection使用,Tomcat的Servlet
  4. Android(安卓)监听wifi广播的两种方式
  5. Android关于桌面快捷方式工具类!
  6. Android(安卓)代码片段---获取手机通讯录列表
  7. Android菜单实现两种方式
  8. 我今天的面试题,注册广播有几种方式,这些方式有何优缺点?请谈谈Andr
  9. Android(安卓)拍照获取不压缩原图方式以及存在的问题

随机推荐

  1. gradle clean报错Could not find manifes
  2. app:preDebugAndroidTestBuild
  3. android mapview
  4. 分享一个Android日志记录的工具类
  5. Android(安卓)桌面快捷方式操作
  6. android 应用选择器的使用
  7. Android对话框的几种形式
  8. android 界面属性
  9. Android(安卓)DrawBitmap绘制图像
  10. android画一条虚线