原创 函數返回值系列之一返回指針類型的局部變量

char *  getString(void)  {          char   p[] = "hello world";          r

原创 String 類構造函數

String::String(const char *str) {       if(NULL==str)       {            

原创 大白菜傻瓜式u盤裝機

第一步:製作u盤啓動盤                  1、下載大白菜u盤啓動盤製作工具                  2、安裝此工具                  3、打開這個自作工具,選擇要製作的u盤,然後單擊一鍵製成usb

原创 I/O操作

操作設備文件 操作連接到主機串口的外設(密碼鍵盤)打開串口設備:int open(char* devname){int fd;if((fd = open(devname, O_RDWR)) < 0){cout<<"open termio

原创 unix網絡編程之udp

   #include <iostream>    #include <arpa/inet.h>    #include <sys/socket.h>    using namespace std;    int main(int arg

原创 管道

 單向無名管道:佔用兩個文件描述符(讀,寫),用於父子進程中父寫子讀#include <iostream>using namespace std;int main(){int fileds[2];char buf[256];pid_t p

原创 unix精確定時

#include <iostream>#include <sys/time.h>#include <signal.h>using namespace std;int n=0;void timefunc(int sig){signal(SI

原创 進程

退出處理函數class A{    public: A(){   cout<<"A()"<<endl;}~A(){   cout<<"~A()"<<endl;}};void f(){  cout<<"f()"<<endl;        

原创 消息隊列

消息隊列,寫進程#include <iostream>#include <sys/msg.h>using namespace std;int main(int argc, char* argv[]){    if(argc == 1) 

原创 利用棧將中綴表達式轉換成後綴表達式

目的:將中綴表達式(即標準形式的表達式)轉換爲後綴式。 例子:a+b*c+(d*e+f)*g轉換成abc*+de*f+g*+   轉換原則: 1.當讀到一個操作數時,立即將它放到輸出中。操作符則不立即輸出,放入棧中。遇到左圓括號也推

原创 消息隊列

消息隊列:先進先出根據不同的交易類型組建不同的消息報文,填寫不同的消息類型,寫入同一消息隊列。各類交易處理程序分別從消息隊列中讀取特定類型的消息並處理(即使不在隊頭,讀完後從隊列中刪除)發送端:#include <iostream>#in

原创 共享內存

共享內存:最快的IPC對象,不借助第三方,可被多個進程直接訪問寫共享內存wshm.cc#include <iostream>#include <sys/shm.h>using namespace std;#define VERIFY(a,

原创 靜態順序表的實現

  /******************************************* the headfile of static sequence list, which defines the class of static

原创 獲取系統信息

取得計算機名      #include <iostream>      using namespace std;      int main()      {  char name[256]={};  int res;  res = g

原创 unix網絡編程之tcp

 ipserver.cc:   #include <iostream>   #include <sys/socket.h>   #include <arpa/inet.h>   using namespace std;   int mai