![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux c/c++
李趴菜
这个作者很懒,什么都没留下…
展开
-
linux c/c++ undefined reference to 'pthread_create' 未定义pthread_create问题
[jl@localhost test]$ gcc thread1.c -o thread1/tmp/ccDLNe7T.o: In function `main':原创 2012-06-07 10:06:38 · 806 阅读 · 0 评论 -
linux c/c++ 加油站
Linux至少需要两个硬盘分区 ,根分区和交换分区。根分区有ext2:标准文件系统;ext3:日志文件系统ext4:增加了日志校验 Linux默认分区格式为ext2或ext3 推荐的分区软件”norton patitionmagic”原创 2013-12-24 18:20:11 · 701 阅读 · 0 评论 -
linux c/c++ 注意
1.函数和过程动词小写后加“_”分隔符,分隔符后的第一个词小写,其他字头大写。只允许一个分隔符 如:get_cpuCccupy()2.类系统表类,每个单词的首字母大写,其他字母小写,不加分隔符,如:UserInfo其他类,字头大写,不加分隔符,前跟“C”原创 2012-08-24 12:33:49 · 458 阅读 · 0 评论 -
linux c/c++ 函数的重载
#includeusing namespace std;struct complex{ double real; double imaginary;};int main(){ int m,n; double x,y; int add(int m,int n); //声明整函数 double(double x,dou原创 2012-07-29 21:30:16 · 531 阅读 · 0 评论 -
linux c/c++ 第一次使用GDB调试小小程序
[root@localhost test]# gcc test.c -o test -g[root@localhost test]# gdb testGNU gdb (GDB) Fedora (7.2-16.fc14)Copyright (C) 2010 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3原创 2012-07-05 16:33:47 · 505 阅读 · 0 评论 -
linux c/c++ rename_file方法的问题
前提是在一参里的文件存在二参也存在调用后的结果是 /home/jiangli/test/rename.txt没了出现在/home/jiangli/test/home/jiangli/test/rename.txt问题就是目录解析的有点问题啊rename_file里的c_str是库函数标准头文件是作用是把string串变成C字符串内容与原来是一样的(gdb) p szDest原创 2012-07-18 16:11:20 · 3826 阅读 · 0 评论 -
linux c/c++ C语言库函数atoi
功能:把字符串转换成整形数 array to integer原型:int atoi( const char* nptr)头文件:#include eg:#include#includeint main(){ char* str="1234.56"; int n; n=atoi(str); fprintf(stdout,"str原创 2012-07-25 15:09:33 · 1143 阅读 · 0 评论 -
linux c/c++ strnlen函数
函数原型:size_t strnlen(const char *s, size_t maxlen);功能:获取字符串s中实际字符个数,不包括结尾的'\0';如果实际个数 if ( 实际个数 {return 实际个数} else {return 2参}2参示例:#include #include int main(){ c原创 2012-07-27 15:50:24 · 2716 阅读 · 0 评论 -
linux c/c++ 默认形参值
int add(int x=5,int y=6){ return x+y;}int main (){ add(10,20);/ /用实参来初始化形参,实现10+20=30; add(10);// 只有一个10赋给x,y采用默认值6 ,10+6=16; add();// x,y都采用默认值,分别为5和6,5+6=11;}原创 2012-07-29 14:25:51 · 949 阅读 · 0 评论 -
linux c/c++ 内联函数
内联函数:不是在调用时发生控制转移,而是在编译时将函数体嵌入在每一个调用处,节省了参数传递 控制转移开销#includeusing namespace std;inline double CalArea(double radius){ return 3.14 * radius * radius;}int main(){ double r(3.0)原创 2012-07-29 13:56:11 · 383 阅读 · 0 评论 -
linux c/c++ fgets函数的使用
原型char *fgets(char *str, int size, FILE * stream);fgets(buff,n,fp);从fp所指文件中读取数据,最多读n-1个, 发现换行符则读取停止(就是fgets函数是一行一行读取的,n若小于一行 则就读n-1个字节,自动添加\0完成读操作);原创 2016-11-19 16:58:49 · 1686 阅读 · 0 评论 -
linux c/c++调用系统自带的动态函数
由于不知道dll文件原创 2016-11-21 10:34:26 · 344 阅读 · 0 评论 -
linux c/c++ 内存表学习
http://www.cnblogs.com/wusee/archive/2012/05/27/2519902.html原创 2014-10-16 14:08:15 · 536 阅读 · 0 评论 -
linux c/c++ vc++ 6.0的open按钮不好使 ,一打开就关闭
这是VC6.0的一个兼容性问题,可以按官方方法试一下原因:VC与VISIO冲突解决方法:1. 下载FileTool.exe,并解压下载地址http://support.microsoft.com/kb/241396/zh-cn2. 打开VC6.0,点击File-Open Workspace,选择刚解压出来的FileTool.dsw,并确定3. 点击Bulid-Build F原创 2012-06-29 08:49:38 · 1604 阅读 · 0 评论 -
linux c/c++ 解决隐式声明与内建函数不兼容问题
缺少 #include man memset 就可以知道memset包含在哪个头文件中 警告:隐式声明与内建函数'memset'不兼容警告:隐式声明与内建函数'strcpy'不兼容警告:隐式声明与内建函数'strstr'不兼容警告:隐式声明与内建函数'strncpyt'不兼容警告:隐式声明与内建函数'strlen'不兼容原创 2012-06-06 17:30:35 · 5141 阅读 · 0 评论 -
linux c/c++ write() read () 函数的使用
write ( )原型:#include size_t write(int fd,const void *buf,size_t nbytes);功能:把缓冲区buf 的前nbytes个字节写入与文件描述符fd关联的文件中返回:返回实际写入的字节数,0 代表未写出数据 ;-1 调 write( )出错了 错误代码保存在 errno 里面原创 2012-06-07 10:38:00 · 3391 阅读 · 0 评论 -
linux c/c++ while();进入死循环
while();后面加个分号表示循环一个空语句, 所以进入了死循环原创 2012-06-07 21:50:01 · 1539 阅读 · 0 评论 -
linux c/c++ unsigned int i;i永远>=0了
unsigned int i;i永远>=0了 #includeint main(){ unsigned int i; for (i=10;i>=0;i--) { printf("%d\n",i); } printf("\n");} 一不小心进入了死循环 因为i是unsigned型的 所以i>=0 永远成立原创 2012-06-07 22:00:34 · 768 阅读 · 0 评论 -
linux c/c++ 直接使用底层系统调用效率低
系统调用会影响系统的性能在执行系统调用时LINUX必须从用户代码切换到内核代码运行然后在返回到用户代码开销有点大#include//在每个函数中必须最早出现 因为它根据POSIX规范定义的标志可能会影响到其他的文件 要加在前面哦 #includesize_t write(int fd,const void*buf,size_t nbytes);size_t rea原创 2012-06-08 08:25:37 · 1606 阅读 · 0 评论 -
linux c/c++ memset();memcpy(),strcpy(),strncpy()等拷贝函数们
#includevoid *memset(void *s,int ch,size_t n);功能:把s所指内存区域的前n个字节设置成字符ch.返回值:返回指向s的指针例子:例:char a[10];memset(a, '\0', sizeof(a));//不太懂啦memset可以方便的清空一个结构类型的变量或数组。如:struct _test{char s[原创 2012-06-08 09:54:51 · 927 阅读 · 0 评论 -
linux c/c++ 用sscanf或者scanf时数值变量前请不要忘记加&&&&&&&&&&&&&&&&&&&&&
用sscanf或者scanf时数值变量前请不要忘记加&&&&&&&&&&&&&&&&&&&&&真的很容易忘记啊原创 2012-06-19 15:43:01 · 2247 阅读 · 0 评论 -
linux c/c++ fd_set
一种数据结构 long类型的数组 用来装socketfdFD_ZERO(&allset); 清空那个集合 使里面没有fdFD_SET(iListenFd,&allset);把iListenFd加到集合中if(FD_ISSET(iListenFd,&rset))//测试文件描述符是否在集合中nready=select(iMaxFd+1,&rset,NULL,NULL,NULL);检查原创 2012-06-26 22:01:04 · 1354 阅读 · 0 评论 -
linux c/c++ 使用otl实例
首先加入头文件 #include using namespace std;#include #define OTL_ORA7 // Compile OTL 4.0/OCI7#include "otlv4.h" // include the OTL 4.0 header fileotl_connect db; // connect object主函数里加入ot原创 2012-06-27 10:23:48 · 1306 阅读 · 0 评论 -
linux c/c++ libevent 定时提醒小小例子
首先 linux上安装好libevent编辑代码#include#includestruct event ev;struct timeval tv;void time_cb(int fd,short event,void *argc){ printf("timer wakeup!\n"); event_add(&ev,&tv);}int ma原创 2012-06-27 16:30:27 · 2300 阅读 · 0 评论 -
linux c/c++ 让自己写的程序在后台运行
关掉刚才的FTP在重新打开 程序还在运行哦原创 2012-06-28 14:36:53 · 3040 阅读 · 0 评论 -
linux C/C++ 添加用户
执行命令:useradd -g oinstall -G dba -d/home/oracle oracle命令说明:添加一个oracle用户,根目录是/home/oracle,主的组是oinstall,副的组是dba原创 2016-12-04 12:25:59 · 848 阅读 · 0 评论