C Builder code snippet
This article contains some common code snipples to see if we think that there is a stone of his mountain to attack jade. CKer
Deleting all the forms of pure virtual functions in the alias Fun Function Page Pointer For the FOR loop variable for the pointer to the reference table and the constant declaration of the constant Check the table in the class name of the component, the text character stream checklist in the class name of the clipboard is open. Operation Change PageControl's label to Query Parameter Date Property Drawing Status
Delete all tables in the alias Void Tdata :: cleantemp () {tstringlist * mytables = new tstringlist (); ttable * table = new ttable (this); try {session-> gettablenames ("temp", ", true, false , myTables);} catch (...) {} // Ansistring str = myTables-> getText (); // showMessage (STR); for (int count = 0; count
class Base {public: virtual void Display () {ShowMessage ( "Base Class");}}; class DerivedOne: public Base {public: void Display () {ShowMessage ( "DerivedOne");}}; class DerivedTwo: public Base {public: void Display () {ShowMessage ( "DerivedTwo");}}; Base * pBases [10]; int count = 0; DerivedOne aDerOne; DerivedTwo aDerTwo; pBases [count ] = & aDerOne; pBases [count ] = & aDerTwo; For (int i = 0; i
{2, 4, 6, 8, 10} int * myinteger = array; int myinteger = myptr [3]; / / value is 8 back to the pointer release reference INT x = 32; int * PTR = & x; // Release pointer Reference file: // to get the content of memory location int y = * ptr; // y = 32 back table for loops VOID TDATAMODULEMPLOYE :: ListNames (TSTRINGS * ITEMS) {TRY {for (TableAll-> first (); ! TableAll-> EOF; TableAll-> Next ()) IF (TableAll-> FieldByname ("deleted") -> asboolean == false) items-> addObject (TableAll-> FieldByname ("name") -> asstring, Tobject *) TableAll-> FieldByname ("refNum") -> asinteger;} catch (exception & e) {Application-> Showexception (& E);};} BACK variables and constants CHAR CH; int count = 1; char * name = "9cbs.net"; struct complex {float my, his;}; float real (complex * p) {return p-> my}; const double pi = 3.1415926535897932385; TempleTate ABC (T a) {Return a 0? -A: a;}; enum Website {One, Two, Three, Four}; INT * A; // * Pointer Char * P [20]; // [] array vid myfunction (int); // ) Function str {short length; char * p;}; char CH1 = 'a'; char * p = & ch1; // & reference, p keeping CH1's address CHAR CH2 = * P; // CH2 = 'a' Back checklist exists #include "io.h" if (access (table1-> tablename.c_str (), 0)) File: // Check the table if there is { // If there is no existence, create ... Table1-> Active = false; table1-> TableType = TTPARADOX; table1-> Fielddefs-> clear (); table1-> fielddefs-> add ("myfield", ftstring, 15, False); table1-> indexdefs-> clear (); table1-> createTable (); table1-> active = true;} else table1-> active = true; BACK component class name // Find lost component class name For (int i = 0; i Tcomponent &> (* Components [i]). Name) == "") {showMessage (Components [i] -> classname ());}}}}}}}}}}}}}}}}}} <> #Include "clipbrd.hpp" file: // contains the Tclipboard & Clipboard () // Example program containing a MEMO control __fastcall tform1 :: tForm1 (tComponent * Owner): TForm (Owner) {file: // creation TStringList object auto_ptringlist (new tstringlist); file: // Get copy cliptext-> text = clipboard () -> astext; file: // then processed ... MEMO1-> lines-> addstrings (ClipText.get ());} Back character stream // example one #include "sstream" const char * name = "cker"; const char * email = "cker@sina.com"; // Generate "CKER" [ SMTP: cker@sina.com] ostringstream Ost; OST << "/" << name << "/" [SMTP: "<< Email <<"] "; edit1-> text = ost.str (). c_str (); file: // Example 2 Void TdataModuleEmployee :: FullReport (const char * title) {report.header; Report << SFormat ("Employee #% 2D:% S% S / N", TableAllRefnum- > Value, TableAllName-> text.c_str (), TableAllManagerflag-> value? ":" "" << "Address: << TableAlLaddres S-> text.c_str () << Endl << "<< TableAllCityProvzip-> text.c_str () << Endl <<" << NameCountry (TableAllCanada-> Value) << Endl; Report.footer () } The back check list has been opened void tdata :: checkedit () {for (INT i = 0; i IS in edit mode "" / rwould you like to post it before enter new task? "; if (MessageBox (null, s.c_str ()," Table in Edit Mode ", MB_YESNO | MB_ICONITION == iDYES) ((Ttable) *) Components [i]) -> POST (); Else ((TTable *) Components [i]) -> Cancel ();}}}} The status operation of the Back table // Close the open table and restore them Be initial. Void Tdata :: MyTables (TForm * sender) {INT i; TTABLE * TABLE; BOOL * ACTIVE = New Bool [MyClass-> ComponentCount]; // Store the initial state of each table in a dynamic array, then close all tables For (i = 0; i For (i = 0; i