“C++”目录存档

epoll使用

2009年12月11日,星期五

转自csdn

名词解释:man epoll之后,得到如下结果:

NAME
epoll – I/O event notification facility

SYNOPSIS
#include <sys/epoll.h>

DESCRIPTION
epoll is a variant of poll(2) that can be used either as Edge or Level
Triggered interface and scales well to large numbers of  watched  fds.
Three  system  calls  are provided to set up and control an epoll set:
epoll_create(2), epoll_ctl(2), epoll_wait(2).

An epoll set is connected to a file descriptor created  by  epoll_cre-
ate(2).   Interest for certain file descriptors is then registered via
epoll_ctl(2).  Finally, the actual wait is started by epoll_wait(2).

(全文…)

boost 中文翻译项目

2009年12月11日,星期五

http://groups.google.com/group/boost_doc_translation

http://code.google.com/p/boost-doc-zh/

C++ string转int

2009年12月11日,星期五

1:

#include <iostream>
#include <string>
using namespace std;

int main()
{
string str=”123456″;
int i;
char buf[10];

strcpy(buf,str.c_str());
sscanf(buf,”%d”,&i);

cout<<”i :”<<i<<endl;
return 0;
}

(全文…)

C++ int转string

2009年12月11日,星期五

1.   int sprintf( char *buffer, const char *format [, argument] … );
<stdio.h>
例如:
int ss;
char temp[64];
string str;
ss = 1000;
sprintf(temp, “%d”, ss);
string s(temp);
//调用string的方法
cout<<s.c_str()<<endl;//1000
cout<<s.size()<<endl;  //长度为4
(全文…)

Linux下C时间函数

2009年12月9日,星期三

日期时间篇
asctime
ctime
gettimeofday
gmtime
localtime
mktime
settimeofday
time

(全文…)

linux下C/C++编译命令

2009年11月24日,星期二

转载

1.gcc包含的c/c++编译器

gcc,cc与c++,g++

gcc和cc是一样的,c++和g++是一样的。一般c程序就用gcc编译,c++程序就用g++编译。

2.gcc的基本用法

gcc test.c:如果没有指定输出的文件,默认将编译出一个名为a.out的程序

gcc test.c -o test:-o参数用来指定生成目标程序的名字,这样将编译出一个名为test的程序。

3.为什么会出现undefined reference to ‘xxxxx’错误?

(全文…)