学习

greex 2012-07-25 09:23:18
http://blog.csdn.net/coding_hello/article/details/2994158
...全文
208 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
greex 2013-03-08
  • 打赏
  • 举报
回复
#coding=utf-8 import xml.etree.ElementTree as et class xmlPase(): def __init__(self,fName): self.root=et.parse(fName).getroot() def get(self,keyParents,keyName): parentKeyObj = self.root.find(keyParents) if(parentKeyObj==None): print "error tag:",keyParents return None return parentKeyObj.find(keyName).text.encode('gb2312') def test(self): print self.fName def __del__(self): self.root=None #coding=utf-8 from xmlPase import * if __name__=='__main__': xmlObj=xmlPase('C:/Documents and Settings/Administrator/桌面/bb/cjsh.xml') print xmlObj.get('Baseinfo','Createtime') ATTRIB -R -A -S "C:\\Documents and Settings\\Administrator\\桌面\\bb\\*" /S /D python xlsxMake.py pause
cdcjk 2013-02-21
  • 打赏
  • 举报
回复
去学习去学习去学习去学习
greex 2013-02-19
  • 打赏
  • 举报
回复
http://bbs.csdn.net/topics/200000811
greex 2013-02-19
  • 打赏
  • 举报
回复
linux:主要使用backtrace和backtrace_symbols两个函数。 #include <execinfo.h> #include <string> using namespace std; //返回当前堆栈调用列表 string print_trace(int fd, int filter_first_lines) { void *array[MAX_STACK_LAYERS]; size_t size; char **strings; size_t i; string strRet(""); size = backtrace (array, MAX_STACK_LAYERS); strings = backtrace_symbols (array, size); for (i = 0; i < size; i++) { if(i < filter_first_lines) continue; if(fd > 0) { write(fd, strings[i], strlen(strings[i])); write(fd, "\n", 1); } strRet.append(strings[i]); if(i < size-1) strRet.append(1, '\n'); } if(fd > 0) write(fd, "\n", 1); free (strings); return strRet; }
greex 2013-02-19
  • 打赏
  • 举报
回复
主要使用了getcontext和walkcontext两个函数。 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ucontext.h> #include <dlfcn.h> int walker(uintptr_t pc, int sig, void *usrarg) { Dl_info dlip; if(dladdr((void *)pc, &dlip)) { (void)printf(" %08lx %s %s\n", pc, dlip.dli_fname, dlip.dli_sname); return 0; } else { perror("dladdr()"); return -1; } } int bar() { char buf[64]; snprintf(buf, 64, "/bin/pstack %i", getpid()); system(buf); (void)printf("\nprintstack()\n"); printstack(0); ucontext_t ucp; if(getcontext(&ucp)) { perror("\ngetcontext()"); return -1; } else { (void)printf("\nwalkcontext()\n"); return walkcontext(&ucp, &walker, NULL); } } int main(int argc, char *argv[]) { return bar(); }
q2920 2012-07-25
  • 打赏
  • 举报
回复
我也去 可以结贴了
pathuang68 2012-07-25
  • 打赏
  • 举报
回复
我也去学习

15,440

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧