linux下实现多线程有两种函数调用:一种是通过pthread.h里面已经封装好的函数调用,另一种是通过unistd.h里面的fork函数调用。前面已经已经列举了pthread的使用,下面来书fork的例子。
一.fork函数
简单的fork例子
#include
#include
#include
using namespace std;
int main()
{...
分类:
编程语言 时间:
2014-05-23 07:59:41
阅读次数:
395
在做布局时,经常有些部分是重复的,比如title或者foot的地方,最简单的办法当然是直接复制过去,
这里介绍include的用法,有过c++或者c经验的同学一看就明白了,就是把另一个布局包含进来.
先看下实现的效果:
里面上下各有两个文字布局,是用include包含进去的,直接看代码
activity_main.xml:
<RelativeLayout xmlns:android=...
分类:
移动开发 时间:
2014-05-22 13:04:44
阅读次数:
345
21.Collection接口:
1>容器类的添加、删除:
· add(Object o) :将对象添加到集合。
· Remove(Object o) :删除集合中与o相匹配的对象。
2>容器中类的查询:
· Size(): 返回集合中元素的个数。
· isEmpty(): 判断集合中是否包含元素。
· contains(Object o): 判断集合中是否包...
分类:
编程语言 时间:
2014-05-22 13:03:23
阅读次数:
271
#include
#include
struct test
{
char name[20];
void (*func)(char *);
};
void tttfunc(char *name)
{
printf("current is %d\n",__LINE__);
printf("%s\n",name);
}
int main()
{
struct test ttt=
{
.n...
分类:
系统相关 时间:
2014-05-22 11:25:09
阅读次数:
380
#include
#include
#include //system(); 这个指令需要用到此头文件
#include //toupper要用到
#include //在内存管理时用到的头文件
void main()
{
int i;
struct ListEntry {
int number;
struct ListEntry *next;
} start, ...
分类:
其他好文 时间:
2014-05-22 10:51:06
阅读次数:
204
从main()函数开始
public static void main(String [] args) {
VersionInfo.logVersion();
new HMasterCommandLine(HMaster.class).doMain(args);
}
public void doMain(String args[]) {
try {
...
分类:
其他好文 时间:
2014-05-22 09:31:11
阅读次数:
348
代码a
#include
#define maxn 1005
int
a[maxn];
int
dp[maxn];
int
max(int x,int
y)
{
return
x>y?x:y;
}
int
main()
{
int
t,n;
scanf("%d",&t);...
分类:
其他好文 时间:
2014-05-22 09:16:47
阅读次数:
192
数组其实是一种变相的指针,数组名同时也是指针,eg:
CODE == &CODE[0];
数组的加法:
#include
#define SIZE 4
int main(void)
{
shortdates[SIZE];
short* pti;
shortindex;
doublebills[SIZE...
分类:
编程语言 时间:
2014-05-22 08:48:53
阅读次数:
276
#include
#include
#include //system(); 这个指令需要用到此头文件
#include //toupper要用到
#include //在内存管理时用到的头文件
void main()
{
char letter; // Letter typed by the user
printf("Do you want to continue? (...
分类:
其他好文 时间:
2014-05-22 06:18:00
阅读次数:
340
#include
#include
using namespace std;
struct node
{
int shi;
int xu;
int data;
};
int main()
{
int shinum=0;
int xunum=0;
int n;
cin>>n;
node*num=ne...
分类:
其他好文 时间:
2014-05-20 15:28:05
阅读次数:
256