随笔 - 404
文章 - 0
评论 - 1037
阅读 -
136万
07 2012 档案
c++ assert函数
摘要:assert的作用是现计算表达式 expression ,如果其值为假(即为0),那么它先向stderr打印一条出错信息,然后通过调用 abort 来终止程序运行。 文章出处:飞诺网(www.diybl.com):http://www.diybl.com/course/3_program/c++/cppjs/20071111/85534.html
阅读全文
Linux下面的C工程
摘要:看Makefile.am 知道二进制文件由哪些代码生成;grep -n main *.cpp
阅读全文
fgets
摘要:为什么fgets()会读取文件最后一行两次?我们在读取文件时,书中经常提到的逻辑是这样的,但这是错误的!while(!feof(Fp)){fgets(readLine,10000,Fp);//////do something.}原因在于feof()只有在你尝试读取文件结尾之后,才会返回true。也就是说,feof()之解释上次文件读写是否到达结尾,而不是下一次。所以正确的逻辑应该是这样的。while(true) {fgets(readLine,10000,Fp);if( feof(Fp) ) break;////do something.}http://tomsawyer.diandian.c
阅读全文
gdb调试相关
摘要:core文件用于gdb调试比较有用 你可以用 ulimit -a 看一下core file size 如果是0, 可以用ulimit -c unlimited 来指定大小不限, 或者指定固定的大小 http://blog.csdn.net/oyangyufu/article/details/6362798http://cs.baylor.edu/~donahoo/tools/gdb/tutorial.html采用automake方式时,要在makefile.am中加入:xx_LDFLAGS=-static-libtool-libs然后make clean && make DEB
阅读全文
perl shell脚本互调
摘要:1 shell echo 命令会自动加入换行符2. $?接受exit 返回值3.变量等于`执行脚本` ,变量获取的值为脚本最后向STDOUT输出的值例子如下1. perl 调用shell1.sh中的内容#!/usr/bin/shecho `date`;exit 1;test.pl中的内容 1 use strict; 2 use warnings; 3 my $s=`sh 1.sh`; 4 print STDOUT "$s"; 5 my $exitcode=$?>>8; 6 print "$exitcode\n"; 2 shell调用perls
阅读全文
perl脚本调用
摘要:#for hadoop 2 my $hadoopcmd=`which hadoop`;#此处返回的结果带"\n"要注意。 3 chomp $hadoopcmd;print STDERR "$hadoopcmd\n";
阅读全文
C++处理语料的一些注意事项
摘要:fscanf系列,文字中如果存在半角空格的话,容易出错。
阅读全文