摘要: 链接:http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html#Function-NamesGCC provides three magic variables that hold the name of the current function, as a string. The first of these is __func__, which is part of the C99 standard:The identifier __func__ is implicitly declared by the translator as if, 阅读全文
posted @ 2013-08-02 09:54 lc_cnblog 阅读(215) 评论(0) 推荐(0) 编辑
摘要: template void advance (InputIterator& it, Distance n);迭代器辅助函数。使迭代器it偏移n,其中n为整数。#include // std::cout#include // std::advance#include // std::listint main () { std::list mylist; for (int i=0; i::iterator it = mylist.begin(); std::advance (it,5); std::cout << "The sixth elemen... 阅读全文
posted @ 2013-07-17 17:00 lc_cnblog 阅读(11426) 评论(1) 推荐(1) 编辑
摘要: 只有setCheckable(true),这个button才能发射 toggle(bool) 信号。而toggle(bool)代表了button 按下,弹起的状态像0,1的切换开关。 阅读全文
posted @ 2013-07-16 20:27 lc_cnblog 阅读(2087) 评论(0) 推荐(0) 编辑
摘要: 创建一般的Qt Gui 程序一般会默认一个UI 文件 ,但是随着应用程序窗口的增多,同时编辑多个UI 界面是必须的。假设我们已经创建好了一个QTUI的工程,里面已经默认了一个UI文件,但是想在添几个UI。可在工程里添加一个新的ui文件。也即是Qt里的Qt Designer Form Class(UI 相关的类和一个ui文件)。在工程文件夹QTUI上右键-->add New-->Qt-->Qt Designer Form Class,点击 choose 按钮即可。那么在主窗口上调用这个ui即可。但是会出现 "无法解析..."之类的错误,不仅如此 类似ui_* 阅读全文
posted @ 2013-07-10 21:54 lc_cnblog 阅读(4572) 评论(0) 推荐(1) 编辑
摘要: tar在linux上是常用的打包、压缩、加压缩工具,他的参数很多,折里仅仅列举常用的压缩与解压缩参数参数:-c :create 建立压缩档案的参数;-x : 解压缩压缩档案的参数;-z : 是否需要用gzip压缩;-v: 压缩的过程中显示档案;-f: 置顶文档名,在f后面立即接文件名,不能再加参数 (这个不能少)tar -zcvf 压缩打包tar -zxvf 解压举例: 一,将整个/home/www/images 目录下的文件全部打包为 /home/www/images.tar[root@xoaocom ~]# tar -cvf /home/www/images.tar /home/www/i 阅读全文
posted @ 2013-07-06 10:56 lc_cnblog 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 项目 -->选择属性 C\C++-->preprocessor-->preprocessor definition添加GLUT_BUILDING_LIB,中间用分号隔开。然后点击linker-->input--> additional dependencies添加glut32.lib Opengl32.lib Glu32.lib 阅读全文
posted @ 2013-07-05 10:48 lc_cnblog 阅读(156) 评论(0) 推荐(0) 编辑
摘要: mode 可以使 R_OK,W_OK,X_OK(是否可执行),F_OK(文件是否存在)的掩码。成功返回0,失败返回-1 阅读全文
posted @ 2013-03-11 17:19 lc_cnblog 阅读(688) 评论(0) 推荐(0) 编辑
摘要: int sprintf(char *str, const char *format, ...);windows平台下线程安全的格式化字符串函数sprint_s并非标准C函数,因此linux下无法使用,但可以使用snprintf函数代替。int snprintf(char *str, size_t size, const char *format, ...);最多从源串中拷贝n-1个字符到目标串中,然后再在后面加一个0。所以如果目标串的大小为n的话,将不会溢出。函数返回值: 若成功则返回存入数组的字符数,若编码出错则返回负值。snprintf 规定了写入str的最大字节数,防止缓冲区溢出 阅读全文
posted @ 2013-03-11 17:00 lc_cnblog 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 头文件 zlib.hint compress (Bytef * dest , uLongf * destLen, constt Bytef * source , uLongf sourceLen)zib的压缩函数,将source处sourceLen个字节进行压缩,放到dest指向的内存,把压缩后的长度存入destLen指向的地址中。调用前destLen表示dest缓冲区,调用后destLen表示压缩后的长度。调用前需指定destLen。return: Z_OK 成功, Z_MEM_ERROR 内存不足 Z_BUF_ERROR dest的缓冲区太小int uncompress(Bytef ... 阅读全文
posted @ 2013-03-11 16:50 lc_cnblog 阅读(3231) 评论(0) 推荐(0) 编辑
摘要: 条件变量是对全局变量使用的同步机制,一个线程等待条件的成立,另一个线程适当时使条件成立。条件变量的使用很容易造成等待的线程一直休眠下去,要保证等待条件成立的线程在最后一次成立后能结束。可以将条件变量理解成一种全局变量。对它使用时总是先加互斥锁。pthread_cond_t cond 定义了cond的条件变量。初始化有两种方式:静态的和动态的。静态的初始化用PTHREAD_COND_INITIALIZER。动态的初始化则使用pthread_cond_init(&cond, NULL); 第二个参数表示cond的属性,linux没有实现,所以设为NULL销毁用pthread_cond_de 阅读全文
posted @ 2013-03-01 19:42 lc_cnblog 阅读(675) 评论(0) 推荐(0) 编辑