Time of Update: 2018-12-05
1. 裝箱、拆箱還是別名 許多介紹C# .NET學習經驗的書上都有介紹 int -> Int32 是一個裝箱的過程,反之則是拆箱的過程。許多其它變數類型也是如此,如:short <-> Int16,long <-> Int64 等。對於一般的程式員來說,大可不必去瞭解這一過程,因為這些裝箱和拆箱的動作都是可以自動完成的,不需要寫代碼進行幹預。但是我們需要記住這些類型之間的關係,所以,我們使用“別名”來記憶它們之間的關係。 C# 是全物件導向的語言,比 Java
Time of Update: 2018-12-05
對於goto語句,在c/c++中就已經被不推薦使用了,在java中根本就沒有goto的存在了,為什麼c#中又重新使用goto語句呢?首先瞭解一下c#中的goto語句用法:1)基本的作用還是和以前一樣,使用者跳到Label的地方執行語句。//exp1 有效代碼{ { goto labelA; }labelA:}2)但是在c#中,goto只允許在一個語句塊內跳出,或者在一個語句塊內的一個地方跳到另一個地方;3)不允許goto從一個語句塊外面跳入一個語句塊內部的。//exp
Time of Update: 2018-12-05
利用MSCOMM控制項通過串口MODEN實現來電顯示-c# source code註:此代碼都已調試通過處理方式 MSComm控制項提供了兩種處理通訊的方式:一種為事件驅動方式,該方式相當於一般程式設計中的中斷方式。當串口發生事件或錯誤時,MSComm控制項會產生OnComm事件,使用者程式可以捕獲該事件進行相應處理。本文的兩個例子均採用該方式。另一種為查詢方式,在使用者程式中設計定時或不定時查詢MSComm控制項的某些屬性是否發生變化,從而確定相應處理。在程式空閑時間較多時可以採用該方式。
Time of Update: 2018-12-05
1編寫c++類:c.h #include <stdio.h>class AA {public: void Go();}; c.mm#include "c.h"AA::Go() {printf("AA::Go");}2編譯剛剛寫的類,分兩 種運行環境,一種是在模擬器下運行,編譯的目標代碼架構為i386,一種是在真實iphone ipad裡運行,目標代碼架構為armv7,我們先編譯可以在模擬器裡啟動並執行,要用模擬器的gcc編譯器,開啟命令列,鍵入命令:cd /program/code/
Time of Update: 2018-12-05
this linker was not configured to use sysrootsC compiler cannot create executables在ubuntu下想編譯linux kernel,鍵入命令make menuconfig時,報出this linker was not configured to use sysroots查了一下,是因為/usr/local/bin/ld在編譯前沒有被配置為configure --with-sysroot所以下載了binutils-2.
Time of Update: 2018-12-05
//---------------------------------------------------------------------------#pragma hdrstop#include <tchar.h>#include <windows.h>//---------------------------------------------------------------------------enum event_type{ success = 0
Time of Update: 2018-12-05
TIdHTTP *http = new TIdHTTP(NULL);TStringList *formData = new TStringList();try{IdAntiFreeze1->OnlyWhenIdle = false;formData->Add("<?xml version=\"1.0\" encoding=\"utf-8\"?>\<soap:Envelope
Time of Update: 2018-12-05
先說區別,原文出處 http://www.dotnetspider.com/resources/740-Difference-between-class-struct-C.aspx1,class 是參考型別,繼承自System.Object類。structs是實值型別,繼承自System.ValueType類,因此不具有多態性,但注意System.ValueType是個參考型別既然class是參考型別,class可以設為null。但是我們不能將struct設為null,因為它是實值型別。
Time of Update: 2018-12-05
需要用到Indy組件,這個安裝了C++Builder就會有,有於服務端是asp.net編寫的,有一個隱藏欄位__VIEWSTATE,所以要加上它,然後再看伺服器端需要什麼欄位就用TStringList對象Add就可以了,具體代碼如下:TIdHTTP *http = new TIdHTTP(NULL); TStringList *formData = new TStringList(); try{ IdAntiFreeze1->OnlyWhenIdle =
Time of Update: 2018-12-05
本文的目的在於揭示和DOTNET及C#相關的一些常見的和不常見的問題。在這些問題中我的第一篇文章和string資料類型有關,string資料類型是一種參考型別,但是當和其他參考型別比較的時候,很多開發人員可能並不能完全理解它的行為。 問題 對於常見的參考型別,當改變一個對象別名的值時,這種變化也同樣會在一個實際的對象中表現出來;反之亦然。但是對於string類型,似乎不是這樣的。 解釋 參考型別
Time of Update: 2018-12-05
bool TForm1::CopyFile() { DWORD fileSize, pos; int readLen; AnsiString srcPath = ExtractFilePath(Application->ExeName) + "Windows.pdf"; AnsiString destPath = ExtractFilePath(Application->ExeName) + "dest.pdf"; FILE *src, *dest;
Time of Update: 2018-12-05
#include <IniFiles.hpp>TIniFile *ini; ini = new TIniFile( ChangeFileExt( Application->ExeName, ".INI" ) ); Top = ini->ReadInteger( "Form", "Top", 100 ); Left = ini->ReadInteger( "Form", "Left", 100 ); Caption = ini-&
Time of Update: 2018-12-05
bool TForm1::CopyFile2() { AnsiString srcPath = ExtractFilePath(Application->ExeName) + "Windows.pdf"; AnsiString destPath = ExtractFilePath(Application->ExeName) + "dest.pdf"; HANDLE hSrcFile, hDestFile; hSrcFile =
Time of Update: 2018-12-05
因為項目的需要,需要做一個WinForm上傳檔案到Web服務端,其中WinForm用C++Builder2010編寫,Web服務出來端用C#編寫,弄了好久終於可以了,代碼如下:WinForm:UnicodeString templateSavePath = ChangeFileExt(ExtractFilePath(Application->ExeName),"tmp_1.doc"); TIdMultiPartFormDataStream *stream = new
Time of Update: 2018-12-05
C++軟體下載 http://www.codeguru.cn/fav/soft.htmC函數執行個體參考手冊 http://www.codeguru.cn/CPP/CExample/十部演算法經典著作 合集 http://www.codeguru.cn/cpp/10book二級試題全集 http://www.codeguru.cn/cpp/2JiCShiTiJi高品質C++/C編程指南 http://www.codeguru.cn/cpp/AdvanceC++-CProgramGuide應用C+
Time of Update: 2018-12-05
方法一:void bytes_to_hexstr(char* dest, unsigned char* src) { char buffer[3]; for (int i = 0; i < 16; i++) { itoa(src[i], buffer, 16); if (strlen(buffer) == 1) { strcpy(dest + i * 2, "0"); strcpy(dest + i * 2 + 1, buffer); } else
Time of Update: 2018-12-05
發表時間:2007-8-29 12:52:00using System;using System.Collections.Generic;using System.Text;using System.Security.Cryptography;using System.IO;namespace ConsoleApplication1{ class Des { /// <summary> /// 加密函數 ///
Time of Update: 2018-12-05
發表時間:2006-4-12 22:59:00protected override void OnPaint(PaintEventArgs e) { base.OnPaint (e); FontFamily fontFamily = new FontFamily("Times New Roman"); Font font = new Font( fontFamily, 32, FontStyle.Regular, GraphicsUnit.Pixel)
Time of Update: 2018-12-05
標頭檔#ifndef ioshelperH#define ioshelperH #include <fstream>#include <vcl.h>//--------------------------------------------------------------------------- class IOHelper{public: void CopyFiles(char* srcPath, char* destPath);};#endif=========
Time of Update: 2018-12-05
類的資料成員指標及類的成員函數指標代碼如下:struct MemberPointer { int m_a; char* getname(int parama) const; MemberPointer() { m_a = 0; }}; char* MemberPointer::getname(int parama) const { return "hello, my name is member pointer";} int _tmain(int argc, _TCHAR* argv[]){