易截截图软件、单文件、免安装、纯绿色、仅160KB

Beautify your c/c++ source code

http://uncrustify.sourceforge.net/
Ident code, aligning on parens, assignments, etc
Align on '=' and variable definitions
Align structure initializers
Align #define stuff
Align backslash-newline stuff
Reformat comments (a little bit)
Fix inter-character spacing
Add or remove parens on return statements
Add or remove braces on single-statement if/do/while/for statements
Supports embedded SQL 'EXEC SQL' stuff
Highly configurable - 385 configurable options as of version 0.56
Output :
const char *token_names[] =
{
[CT_POUND] = "POUND",
[CT_PREPROC] = "PREPROC",
[CT_PREPROC_BODY] = "PREPROC_BODY",
[CT_PP] = "PP",
};
int main(int argc, char *argv[])
{
struct junk a[] =
{
{ "version", 0, 0, 0 },
{ "file", 1, 150, 'f' },
{ "config", 1, 0, 'c' },
{ "parsed", 25, 0, 'p' },
{ NULL, 0, 0, 0 }
};
}
color_t colors[] =
{
{ "red", { 255, 0, 0 } }, { "blue", { 0, 255, 0 } },
{ "green", { 0, 0, 255 } }, { "purple", { 255, 255, 0 } },
};
struct foo_t bar =
{
.name = "bar",
.age = 21
};
struct foo_t bars[] =
{
[0] = { .name = "bar",
.age = 21 },
[1] = { .name = "barley",
.age = 55 },
};
void foo(void)
{
int i;
char *name;
i = 5;
name = "bob";
}
/**
* This is your typical header comment
*/
int foo(int bar)
{
int idx;
int res = 0; // trailing comment
// that spans two lines
for (idx = 1; idx < bar; idx++)
/* comment in virtual braces */
res += idx;
res *= idx; // some comment
// almost continued, but a NL in between
// col1 comment in level 1
return(res);
}
// col1 comment in level 0
#define foobar(x) \
{ \
for (i = 0; i < x; i++) \
{ \
junk(i, x); \
} \
}


相关文档:

20100527 C陷阱与缺陷读书笔记(一、二章)

  第一章:词法“陷阱”
  字母本身没有意思,但是将字母组成的单词就被赋予了意义。在C语言中,字符组合成了整个代码,由字符书写带来的笔误会带来不少麻烦。作为程序员,不能指望靠编译器来提醒。因此,需要注意:
  1.C语言中,符号之间的空白(包括空格符,制表符,换行符) ......

C标准预定义宏

ANSI C标准中有几个标准预定义宏:__FILE__     __DATE__   __TIME___    __LINE__   等
__LINE__:在源代码中插入当前源代码行号;
__FILE__:在源文件中插入当前源文件名;
__DATE__:在源文件中插入当前的编译日期
__TIME__:在源文件中插入当前编译时间; ......

SD卡的写文件 以及 C中#符号

一  首先总结一下SD卡的写文件,需注意的事项如下:
1. FAT16 写的时候必须至少写一个扇区。
2. FAT表不能频繁的读写,否则会出错。申请新的一个簇时,直接在这个簇里面(即下一簇号)的写为0XFFFF。
3. FAT似乎必须转化成u16才能写。貌似是这样,具体没仔细看。
4. 获取新的索引簇的时候,直接从旧的索引簇的后面 ......

Android原生(Native)C开发之三:鼠标事件篇(捕鼠记)


在做SDL至Android的移植时,键盘事件是能正常捕获到,看了SLD的源码,发现用的device是 /dev/tty0,但是鼠标叫是不能成功捕获,总是得到 0,运行命令查看devices时,显示如下:
 # cat /proc/bus/input/devices
cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="qwerty ......

Ubuntu linux系统下安装C kermit串口工具

解决步骤:
gylu@dell-desktop:~$ sudo apt-get install ckermit
显示安装过程
gylu@dell-desktop:~$gedit ~/.kermrc
输入下面内容后保存.kermrc退出:
   set line            /dev/ttyS0
    set speed    & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号