Time of Update: 2018-07-18
using System.Diagnostics;............. { //************ 壓 縮 ************* string strF="iis6.log"; string strR="newiis";
Time of Update: 2018-07-18
某些情況下希望函數的參數個數可以根據需要確定。典型的例子有大家熟悉的函數printf()、scanf()等。 那麼它們是怎樣實現的呢。 C編譯器通常提供了一系列處理這種情況的宏,以屏蔽不同的硬體平台造成的差異,增加程式的可移植性。這些宏包括va_start、va_arg和va_end等。 下面是通過上面的函數隨便寫的例子: #include"cstdarg"#include"iostream"using
Time of Update: 2018-07-18
delphi ---------------------------------------- var ii: SmallInt ; begin ss[1] := Char($FF); ss[2] := Char($CA); ii := word(ss[1]) *256+ word(ss[2]); edt1.Text := FormatFloat('0.00', ii/10.0); end
Time of Update: 2018-07-18
C Sharp(C#)中如何刪除檔案(檔案夾) 直接刪除:using System.IO; ... string filePath = @"D:/.../xxx.xxx"; if (File.Exists(filePath)) { File.Delete(filePath); } else { Console.WriteLine("file not exist."); Console.ReadLine(); } 刪除到資源回收筒:
Time of Update: 2018-07-18
執行個體 尋找元素5並刪除。 注意事項 尋找時可以使用find函數,此時必須將algorithm標頭檔包含進去。 尋找完成後,如果vector中包含該元素,則返回第一個元素,或者超出末端的下一個位置,返回的是迭代器。 刪除元素之前,必須確保返回的不是end迭代器。 執行個體代碼 #include <iostream>#include <vector>#include <algorithm>
Time of Update: 2018-07-18
//拆分任意類型數組List<T[]> SplitArray<T>(T[] data, int size) { List<T[]> list = new List<T[]>(); for (int i = 0; i < data.Length / size; i++) { T[] r = new T[size]; Array.Copy(data, i *
Time of Update: 2018-07-18
C#串連資料庫並插入資料
Time of Update: 2018-07-18
ref :http://hi.baidu.com/lovevc2008/item/2b69a7caf224e62946d5c093 UTF8是以8bits即1Bytes為編碼的最基本單位,當然也可以有基於16bits和32bits的形式,分別稱為UTF16和UTF32,但目前用得不多,而UTF8則被廣泛應用在檔案儲存和網路傳輸中。 編碼原理 先看這個模板: UCS-4 range (hex.) UTF-8 octet sequence (binary) 0000 0000-0000
Time of Update: 2018-07-18
#include <iostream>#include <Windows.h>#include <string>using namespace std;char* ConvertChineseUnicodeToPyt(wchar_t* chrstr){ const int pyvalue[] = {-20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-200
Time of Update: 2018-07-18
#include <stdio.h> #define FORMAT "%s! C is cool!\n" int main(void) { int num=10; printf(FORMAT,FORMAT); return 0; } 輸出為 %s!C is cool! !C is cool! 將#define FORMAT "%s!C is
Time of Update: 2018-07-18
1.下面的程式為什麼不調用解構函式。 class abc; void del(abc *pobj){delete pobj;}class abc{public: abc(){printf("abc\r\n");}~abc(){printf("~abc\r\n");}};void main(void){abc *pobj = new abc;del(pobj);} 2.而下面的程式則會調用解構函式 class abc{public:
Time of Update: 2018-07-18
在C++中,可以為參數指定預設值。在函數調用時沒有指定與形參相對應的實參時, 就自動使用預設參數。 預設參數的文法與使用:(1)在函式宣告或定義時,直接對參數賦值。這就是預設參數; (2)在函數調用時,省略部分或全部參數。這時可以用預設參數來代替。 注意:(1)預設參數只可在函式宣告中設定一次。只有在沒有函式宣告時,才可以在函數定義中設定。(#add ,此句意為存在函式宣告和定義兩部分的時候。驗證表明有這個限制,可以隨便,但出於規範,在聲明中指定)
Time of Update: 2018-07-18
/************************************************************************/ /* * 檔案名稱:write_log.cpp * 摘 要:此檔案實現了普通WINDOWS程式中的日誌功能
Time of Update: 2018-07-18
且看下面的例子 Class Deriver: public Base { …; }; Base *pb = new Deriver; Delete pb; //子類中含有需要釋放的資源時, //如果沒有聲明virtual ~Base();則會造成記憶體流失.
Time of Update: 2018-07-18
Time of Update: 2018-07-18
來自:http://www.cpplive.com/html/871.html
Time of Update: 2018-07-18
作為C++標準不可缺少的一部分,STL應該是滲透在C++程式的角角落落裡的。STL不是實驗室裡的寵兒,也不是程式員桌上的擺設,她的激動人心並非曇花一現。本教程旨在傳播和普及STL的基礎知識,若能藉此機會為STL的推廣做些力所能及的事情,到也是件讓人愉快的事情。 初識STL:解答一些疑問 1.1 一個最關心的問題:什麼是STL "什麼是STL。
Time of Update: 2018-07-18
主要使用到winspool.drv中的EnumPrinters函數,代碼如下: [DllImport("winspool.drv", SetLastError = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool EnumPrinters ([MarshalAs(UnmanagedType.U4)] PRINTER_
Time of Update: 2018-07-18
在查閱ASN-GW工程檔案原始碼的時候,發現了*.hpp檔案,很奇怪,以前在教科書都沒有學習過,在baidu一下,發現了一下要點: 1、是Header Plus Plus 的簡寫。 2、與*.h類似,hpp是C++程式標頭檔 。 3、是VCL專用的標頭檔,已先行編譯。 4、是一般模板類的標頭檔。 5、一般來說,*.h裡面只有聲明,沒有實現,而*.hpp裡聲明實現都有,後者可以減少.cpp的數量。
Time of Update: 2018-07-18
void printStack( void ){unsigned int i;void * stack[ 100 ];unsigned short frames;SYMBOL_INFO * symbol;HANDLE process;process = GetCurrentProcess();SymInitialize( process, NULL, TRUE );frames = CaptureStackBackTrace( 0