
linux应用
yuanzhenhai
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
linux一些命令
Linux常用命令参考 1. diff 用于文件比较。一般file1是原文件,file2是新(修改过)的文件。 紧凑模式:diff -u file1 file2diff -u file1 file2--- file1 2010-03-06 02:11:43.000000000 +0000+++ file2 2010-04-1原创 2010-04-30 11:21:00 · 428 阅读 · 0 评论 -
gdb传入参数
(gdb) b mainBreakpoint 1 at 0x80485dd: file test.c, line 33.(gdb) run test.g711 teee.txtStarting program: /home/yuan/work/test/wav_file_formate/test test.g711 teee.txtwarning:the debug i原创 2011-06-07 10:46:00 · 1648 阅读 · 0 评论 -
select_stdin.c
1、fgets()参数里,stdin用0代替,会出现 'Segmentation fault' 。对stdout stdin stderr 不了解。 2、当敲入键盘,但没有按下回车键时,程序还是会阻塞在select()里。 3、用memcpy()代替strcmp()做字符串比较。且注意比较字符数是strlen()减 1 。// NAME: select_stdin.c #include #include // exit() #include // bzero() #inclu原创 2011-05-31 14:49:00 · 855 阅读 · 0 评论 -
用signal结束多个线程
在创建多线程时,有时可能几个线程里面都是死循环,如果结束这些线程呢?可以用signal(),这里介绍signal的一个应用。 当然,不用signal(),按Ctrl+C也可以直接结束。// file name:signal_to_stop_thread.c // 接收到特定的信号量,结束多个线程 #include #include #include #include #include //typedef int bool; #define MY_FALSE 0 #d原创 2011-05-25 17:57:00 · 1530 阅读 · 0 评论 -
一个简单的Makefile
<br />##### Change the following for your environment: <br /> C = c<br /> C_COMPILER = cc<br /> C_FLAGS = -g<br /> CPP = cpp<br /> CPLUSPLUS_COMPILER = g++<br /> CPLUSPLUS_FLAGS = -g<br /> THREAD_OPT = -lpthread<br原创 2011-01-07 16:49:00 · 603 阅读 · 0 评论 -
用C++写多线程程序
class Thread { public: Thread(); int Start(void * arg); protected: int Run(void * arg); static void * EntryPoint(void*); virtual void Setup(); virtual void Execute(void*); void * Arg() const {return翻译 2010-12-01 17:50:00 · 576 阅读 · 1 评论 -
live555里的rtp时间戳算法
<br />u_int32_t const rtpTimestamp = fTimestampBase + timestampIncrement;<br /> <br />其中<br /> timestampIncrement = = (fTimestampFrequency*tv.tv_sec);<br /> timestampIncrement += (u_int32_t)((2.0*fTimestampFrequency*tv.tv_usec + 1000000.0)/2000000);<br原创 2010-09-16 17:09:00 · 3143 阅读 · 0 评论 -
linux命令
1、优化代码:indent test.c 另一种模式: indent -kr test.c2、产生Warning和Error信息:gcc -Wall -o out-file source-file3、产生调试信息:gcc -Wall -g -o out-file source-file4、编译多个文件:gcc -o out-file source-file-a source-file-b source-file-c ...原文出自:周立发转载 2010-08-23 17:24:00 · 379 阅读 · 0 评论 -
之前没有留意的 memcpy
<br />#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char *str1 = "abcd"; char *str2 = "efgh"; char *sss; sss = (char*)malloc(20); memcpy(sss,str1,strlen(str1)); printf("str sss onice %s/n",sss); memcpy(sss原创 2010-08-18 18:02:00 · 600 阅读 · 0 评论 -
pthread_cond_wait()
转自:http://blog.youkuaiyun.com/xiaochangfu/archive/2009/10/26/4729342.aspx通过下面的程序来理解: #include #include #include pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /*初始化互斥锁*/ pthread_cond_t cond = PTHREAD_COND_INITIALIZER; //初始化条件变量 void *thread1(void *转载 2010-08-06 15:36:00 · 450 阅读 · 0 评论 -
boost share_ptr的使用例子
#include <stdio.h> #include <iostream> #include <string> #include <map> #include <boost/shared_ptr.hpp> using namespace std; // g++ -c boost_share_ptr.cpp -I ../boost_...原创 2018-04-01 09:00:09 · 376 阅读 · 0 评论