会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
于光远
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
4
5
6
7
8
9
10
11
12
···
19
下一页
2018年8月7日
Linux系统上的popen()库函数
摘要: popen可以是系统命令,也可以是自己写的程序a.out。 假如a.out就是打印 “hello world“ 在代码中,想获取什么,都可以通过popen获取。 比如获取ls的信息, 比如获取自己写的程序的内容:“hello world” 。 https://www.cnblogs.com/syla
阅读全文
posted @ 2018-08-07 20:19 于光远
阅读(16640)
评论(0)
推荐(0)
2018年8月6日
字符串处理,取出按指定分割符号(非空格)进行字符串切割
摘要: void split(const string &s, char delim, vector &elems) { stringstream ss(s); string item; while (getline(ss, item, delim)) { elems.push_back(item); } // return elems; } ...
阅读全文
posted @ 2018-08-06 18:31 于光远
阅读(1625)
评论(0)
推荐(1)
2018年7月29日
C++分离字符串中的数字和字符 转
摘要: 输入: 输出:
阅读全文
posted @ 2018-07-29 19:19 于光远
阅读(617)
评论(0)
推荐(0)
去首尾空格
摘要: string & trim(string &s){ if(s.empty()){ return s; } s.erase(0,s.find_first_not_of(" ")); s.erase(s.find_last_not_of(" ")+1); return s; }
阅读全文
posted @ 2018-07-29 15:02 于光远
阅读(175)
评论(0)
推荐(0)
2018年7月20日
查找在某个路径下的所有源文件
摘要: aux_source_directory 查找在某个路径下的所有源文件。 aux_source_directory(< dir > < variable >) 搜集所有在指定路径下的源文件的文件名,将输出结果列表储存在指定的变量中。该命令主要用在那些使用显式模板实例化的工程上。模板实例化文件可以存储
阅读全文
posted @ 2018-07-20 12:21 于光远
阅读(2759)
评论(0)
推荐(0)
2018年7月8日
创建服务的进程,进程死了会自动重启。
摘要: 在execute函数中最先调用fork()函数,那fork()函数做了些什么呢?其实fork()函数创建了和当前进程基本一模一样的一个子进程。当控制转到内核中的fork代码之后,内核先分配新的内存块和内核数据结构,然后将原来的进程复制到新的进程中去。最后向运行进程中添加新的进程并且控制重新返回到进程
阅读全文
posted @ 2018-07-08 08:52 于光远
阅读(992)
评论(0)
推荐(0)
2018年4月12日
c++ linux 判断string是中文的 or 英文的 字符串。
摘要: 判断占用字节数。
阅读全文
posted @ 2018-04-12 17:26 于光远
阅读(870)
评论(0)
推荐(0)
2018年3月7日
替换文本中,指定行的内容
摘要: #include #include #include #include #include using namespace std; void saveConfigFile( string filePath, string keyStr,string replaceStr){ fstream file(filePath.c_str()); string line; ...
阅读全文
posted @ 2018-03-07 09:49 于光远
阅读(797)
评论(0)
推荐(0)
2017年12月19日
Linux内核中的常用宏container_of其实很简单
摘要: http://blog.csdn.net/npy_lp/article/details/7010752 通过一个结构体变量的地址,求该结构体的首地址。 其中代码难以理解的地方就是它灵活地运用了0地址。如果觉得&( (struct test_struct *)0 )->ch这样的代码不好理解,那么我们
阅读全文
posted @ 2017-12-19 16:57 于光远
阅读(297)
评论(0)
推荐(0)
2017年11月25日
使用rsyslog编程,产生trace信息,记录到日志中
摘要: 参考:http://blog.csdn.net/nowayings/article/details/38926501 https://www.cnblogs.com/bonelee/p/6234647.html 打印到日志中: 代码如下 配置如下:添加第2行部分。 ubuntu@ubuntu-vm:
阅读全文
posted @ 2017-11-25 16:28 于光远
阅读(430)
评论(0)
推荐(0)
上一页
1
···
4
5
6
7
8
9
10
11
12
···
19
下一页
公告