linux 显式调用 自己写的动态库
~/test
|
|
|------main.c
|------lib
| |
| |------StringLen.h
| |------Strlen.c
| |------Strnlen.c
----------------StringLen.h:
#ifndef _STRINGLEN_H__
#define _STRINGLEN_H__
int Strlen(char *pStr);
int StrNlen(char *pStr, unsigned long ulMaxLen);
#endif
-------------------------------------------------
---------------Strlen.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen.h"
int Strlen(char *pStr)
{
unsigned long ulLength;
assert(NULL != pStr);
ulLength = 0;
while(*pStr++)
{
ulLength++;
}
return ulLength;
}
-------------------------------------------------
---------------Strnlen.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen.h"
int StrNlen(char *pStr, unsigned long ulMaxLen)
{
unsigned long ulLength;
assert(NULL != pStr);
if(ulMaxLen <= 0)
{
printf("Wrong Max Length!\n");
return -1;
} &
相关文档:
cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业。由于Cron 是Linux的内置服务,但它不自动起来,可以用以下的方法启动、关闭这个服务:
/sbin/service crond start //启动服务
/sbin/service crond stop //关闭服务
/sbin/service crond restart //重启服务
/sbin/service cron ......
在程序不寻常退出时,内核会在当前工作目录下生成一个core文件(是一个内存映像,同时加上调试信息)。使用gdb来查看core文件,可以指示出导致程序出错的代码所在文件和行数。
1.core文件的生成开关和大小限制
1)使用ulimit -c命令可查看core文件的生成开关。若结果为0,则表示关闭了此功能,不会生成core文件。
......
原文 http://www.9usb.net/200902/linux-grep.html
1.作用
linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。
2.格式
grep [options]
3.主要参数
[options]主要参数: ......
1.编译安装libevent
2.编译安装Memcached
在我写这篇文章的时候,libevent已经有1.4.8稳定版
,Memcached Server已经有1.3.0版本
。本文就以这两个版本为例,我的gcc是gcc version 3.3.4 (Debian 1:3.3.4-7)。
首先安装libevent
wget http://www.monkey.org/~provos/libevent-1.4.8-stable.tar.gz
tar zxvf libeven ......
写共享内存程序:
/*
* File: server.cpp
* Author: centos
*说明:从键盘读入数据,存放在共享内存中。
* Created on 2010年3月1日, 下午3:44
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include < ......