Time of Update: 2017-01-19
方法一:分析 mount 命令的返回資訊,例如:複製代碼 代碼如下:$ mountrootfs / rootfs ro,relatime 0 0tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0devpts /dev/pts devpts rw,relatime,mode=600 0 0proc /proc proc rw,relatime 0 0sysfs /sys sysfs rw,relatime 0 0debugfs /sys/kernel/
Time of Update: 2017-01-19
去除C代碼中的注釋,1. 單行注釋//;2. 多行注釋/**/;3. 單行注釋以“\”結尾則下一行也為注釋;4. 字串中的注釋不處理。說是C語言,但其實所有C語系的都可以,比如Java。小工具:去除C語言注釋 複製代碼 代碼如下:#include <stdio.h>int main(int argc, char* argv[]) { enum { literal,
Time of Update: 2017-01-19
複製代碼 代碼如下:/** 實現二叉尋找樹的準系統*/#include <iostream>#include <cstring>#include <algorithm>#include <cstdio>#include <string>using namespace std;const int M = 10000;//定義資料節點class dNode{public: string name; int
Time of Update: 2017-01-19
步驟為:1.從數列中挑出一個元素,稱為 "基準"(pivot);2.重新排序數列,所有元素比基準值小的擺放在基準前面,所有元素比基準值大的擺在基準的後面(相同的數可以到任一邊)。在這個分區退出之後,該基準就處於數列的中間位置。這個稱為分區(partition)操作。3.遞迴地(recursive)把小於基準值元素的子數列和大於基準值元素的子數列排序。遞迴的最底部情形,是數列的大小是零或一,也就是永遠都已經被排序好了。雖然一直遞迴下去,但是這個演算法總會退出,因為在每次的迭代(iteration)
Time of Update: 2017-01-19
複製代碼 代碼如下:#include <stdio.h>#include <stdlib.h>typedef char DataType;typedef struct Node{ DataType data; struct Node * Next;}ListNode,* LinkList;void Judement(LinkList head){ //判斷分配記憶體
Time of Update: 2017-01-19
複製代碼 代碼如下:#include <stdio.h>#include <windows.h>#include <wininet.h>#define MAXSIZE 1024#pragma comment(lib, "Wininet.lib") void urlopen(_TCHAR*);int _tmain(int argc, _TCHAR* argv[]){
Time of Update: 2017-01-19
ANSI C規定檔案開啟用函數fopen,關閉為fclose。1、調用方式通常為:複製代碼 代碼如下:FILE *fp;fp=fopen(檔案名稱, 開啟檔案);2、參數說明:檔案名稱: 形如"myfile.dat"、"F:\data\myfile.dat"等等;開啟檔案:"r"(唯讀) 為輸入開啟一個文字檔"w"(唯寫) 為輸出開啟一個文字檔"a"(追加) 向檔案檔案尾添加資料"rb"(唯讀) 為輸入開啟一個二進位檔案"wb"(唯寫) 為輸出開啟一個二進位檔案"r+"(讀寫)
Time of Update: 2017-01-19
1.fseek 函數原型:複製代碼 代碼如下:int fseek ( FILE * stream, long int offset, int origin );參數說明:stream,檔案流指標;offest,位移量;orgin,原(始位置。其中orgin的可選值有SEEK_SET(檔案開始)、SEEK_CUR(檔案指標當前位置)、SEEK_END(檔案結尾)。函數說明:對於二進位模式開啟的流,新的流位置是origin + offset。2.ftell函數原型:long int ftell (
Time of Update: 2017-01-19
C++ vector中實際刪除元素使用的是容器vecrot std::vector::erase()方法。C++ 中std::remove()並不刪除元素,因為容器的size()沒有變化,只是元素的替換。1.std::vector::erase()函數原型:iterator erase (iterator position);//刪除指定元素iterator erase (iterator first, iterator
Time of Update: 2017-01-19
1.資料結構複製代碼 代碼如下:struct dirent{ long d_ino; /* inode number 索引節點號 */ off_t
Time of Update: 2017-01-19
這兩天我寫了一個測試c++異常處理機制的例子,感覺有很好的示範作用,在此貼出來,給c++異常處理的初學者入門。本文後附有c++異常的知識普及,有興趣者也可以看看。下面的代碼直接貼到你的console工程中,可以運行調試看看效果,並分析c++的異常機制。複製代碼 代碼如下:#include "stdafx.h" #include<stdlib.h> #include<crtdbg.h> #include <iostream> //
Time of Update: 2017-01-19
第1章 快速入門1,介紹main函數的意義和其基本結構,return語句。不同平台下編譯與執行程式。2,兩個類isrteam與otream與它們的執行個體對象cin,cout,cerr,clog。說明了程式中基本的輸入與輸出。“<<”與”>>”作為操作符,左操作符是一個iostream 對象,右操作符是一個變數。傳回值仍為一個iostream對象,所以輸入或輸出可以這樣 cout<<”a=”<<a<<endl
Time of Update: 2017-01-19
函數在C++中的使用,無非2種地方,一處是函數的定義,一處是函數的調用。而函數的定義則非常簡單,由三個部分組成:函數的傳回型別、函數名和函數的形參表。當然,這裡不同的函數定義可以還會稍有不同,比如類的成員函數、內嵌函式等。這裡我們主要討論函數的調用時需要注意的一些問題。一、參數傳遞我們將函數定義或聲明裡的參數叫形參,而在調用函數時傳入的參數叫實參。那麼根據形參類型的不同,有幾下形式的參數傳遞。1,非引用形參1)普通的內建類型普通非參考型別的參數通過複製對應的實參實現形參的初始化。當用實參的副本初
Time of Update: 2017-01-19
SortAlgorithm.h複製代碼 代碼如下:#include <vector>using namespace std;class SortAlgorithm{public: SortAlgorithm(int = 10); void displayVector(); void swap(int &, int &); void
Time of Update: 2017-01-19
複製代碼 代碼如下://相當於為現有類型建立一個別名,或稱類型別名。//整形等typedef int size;//字元數組char line[81];char text[81];//=>typedef char Line[81];Line text, secondline;//指標typedef char * pstr;int mystrcmp(pstr p1, pstr p2);//註:不能寫成int mystrcmp(const pstr p1, const pstr
Time of Update: 2017-01-19
複製代碼 代碼如下:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>static const char b64_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static const char reverse_table[128]
Time of Update: 2017-01-19
方法:複製代碼 代碼如下:long filesize(char* filename);char* file_get_contents(char* filename);void file_put_contents(char* filename, char* data);樣本:複製代碼 代碼如下:#include <stdio.h>#include <stdlib.h>#include <string.h>long filesize(char* filename)
Time of Update: 2017-01-19
複製代碼 代碼如下:/// <summary>/// 獲得縮微圖/// </summary>/// <returns></returns> public bool GetThumbImg(){try{string imgpath; //原始路徑 if(imgsourceurl.IndexOf("\",0)<0) //使用的是相對路徑 {
Time of Update: 2017-01-19
JS代碼: Code: 複製代碼 代碼如下: var _MaxPageSize = 0; var _PageSize = 5; var _IsUpDown = false; function InitPage(funName, currentPageSize, maxPageSize, pageSize, isUpDown) { _FunName = funName; _CurrentPageSize = currentPageSize; _MaxPageSize = maxPageSize;
Time of Update: 2017-01-19
假如Excel中的資料如下:資料庫建表如下:其中Id為自增欄位:代碼:複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.OleDb;using