不错的C代码
文章平均质量分 76
Season_hangzhou
这个作者很懒,什么都没留下…
展开
-
大数相乘中最简洁的C代码,但效率未必是最高的
# include # include # include void multiply(char* a,char* b,char* c) { int i,j,ca,cb,* s; ca=strlen(a); cb=strlen(b); s=(int*)malloc(sizeof(int)*(ca+cb)); for (i=0;i转载 2012-11-13 16:38:48 · 905 阅读 · 0 评论 -
hex_to_bin的busybox实现
static unsigned hex_to_bin(unsigned char c) { unsigned v; v = c - '0'; if (v return v; /* c | 0x20: letters to lower case, non-letters * to (potentially different) non-letters */转载 2013-01-06 13:47:08 · 764 阅读 · 0 评论 -
sscanf的特别用法(类似正则表达式)
原问题: iios/12DDWDFF@122 获取/和@之间的字符串怎么做 C程序里面有什么函数吗? 周星星的代码: #include int main() { const char* s = "iios/12DDWDFF@122"; char buf[20]; sscanf( s, "%*[^/]/%[^@]", buf );转载 2012-12-20 17:06:54 · 571 阅读 · 0 评论 -
将16进制文本转换为ascii码的C语言代码
我用的将16进制文本转换为ascii码的C语言代码。16进制文本复制到文件test.txt中,运行程序,将得到输入。 例: 运行:./CSTRING test.txt 其中,test.txt文件内容为: 30:31:32 则得到的"Cstring.txt"输入文件中 012 本程序能自动跳过0或多个分隔符(分隔符可以为任意的符号,如“:”,“%”或空格等,判原创 2013-03-15 16:27:40 · 13081 阅读 · 0 评论