- 博客(8)
- 收藏
- 关注
原创 父进程与子进程管道
int main(){ int pfd[2]; char test[10] = "hello"; pid_t pid; int n = 0; int status; pipe(pfd); pid = fork(); if (pid == 0) { close(pfd[0]); //while (1); n = write(pfd[1...
2010-06-26 17:49:49 576
原创 Socket
转载:http://apps.hi.baidu.com/share/detail/4783469什么是Socket Socket接口是TCP/IP网络的API,Socket接口定义了许多函数或例程,程序员可以用它们来开发TCP/IP网络上的应用程序。要学Internet上的TCP/IP网络编程,必须理解Socket接口。 Socket接口设计者最先是将接口放在Unix操作系统里面的。...
2010-06-16 20:54:43 89
原创 引用与指针
int a = 10;int & b = a; //声明引用时要将其初始化int * pa;pa = &a; //指针不用 int & b = a; 一旦与某个变量关联起来,就将一直效忠于它其实其伪装表示为:int * const pa = &a;其实 b 的角色与 *pa 相同 ...
2010-06-15 09:50:12 101
原创 为什么需要函数原型?
原型描述了函数到编译器的接口, 也就是说,他将函数返回值的类型(如果有的话)以及参数的类型和数量告诉编译器eg: double cube(double x); double volume = cube(side); 首先,原型告诉编译器, cube()有一个double参数, 如果程序没有提供这样的参数,原型将让编译器能够捕获这种错误,其次,cube()函数计算完后,将把返...
2010-06-14 19:15:46 407
原创 cin.get(), cin.getline()
c++ 中, cin.get(name, 20) 会保留换行符在输入序列里, 所以一般这样写 cin.get(name, 20).get();来消除换行符 cin.getline(name, 20), 不会保留换行符
2010-06-14 18:14:30 134
原创 c++ while循环延迟输出
#include <iostream>#include <ctime>using namespace std;int main(){ float sec, delay; clock_t start; cout << "enter the delay sec: \n"; cin >> sec; delay ...
2010-06-14 17:29:10 732
原创 图书管理 c
#ifndef _LIST1_H_#define _LIST1_H_#include <stdbool.h>#define TMAX 50struct item{ char title[TMAX]; float price;};typedef struct item Item;struct node{ Item item; struc...
2010-06-07 22:37:19 120
原创 数据结构-栈(1)
栈ADT链表实现的生命#ifdefstruct Node;typedef struct Node * PtrToNode;typedef PtrToNode Stack;int IsEmpty (Stack S);Stack CreateStack (void);void DisposeStack (Stack S);void MakeEmpty (Stack ...
2010-06-07 22:23:17 100
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人