July 23, 1999

Use Static Allocation for Fixed Size Memory Buffers

Imagine you have to write a simple stock quote application that accepts stock symbols and retrieves their current values. Using a std::string object to represent a stock symbol is inefficient because std::string allocates an initial buffer that has 16 to 64 characters, depending on the actual platform. Since a stock

Understanding File Descriptors

When a program opens a file, the operating system returns a corresponding file descriptor that the program refers to in order to process the file. A file descriptor is a low positive integer. The first three file descriptors (0,1, and 2,) are associated with the standard input (stdin), the standard

Forward-Declaring I/O Classes and Templates

The standard header contains forward-declarations of the I/O classes and templates. This header is sufficient to refer to any of the I/O classes and templates but not to apply operation to them. For example: #include using namespace std;class C{public: friend ostream& operator

Overloading the Function Call Operator

Overloading the function call operator can be somewhat confusing because the overloaded operator has two pairs of parentheses. It may not be immediately obvious which of these pairs declares the parameters. Another point to note is that the overloaded function call operator may take any number of arguments whereas all

A Shorthand for “Constructor” and “Destructor”

The abbreviated forms “ctor” and “dtor” (“c-tor” and “d-tor”) are widely used in C++ literature, newsgroups, magazines, and in the ANSI/ISO Standard. These terms are simply the shorter forms of “constructor” and “destructor”.

Q&D Zoom Using Forms 2.0 Designer

How would you like to be able to make a form automatically resize and reposition all its controls and fonts whenever you resize the form? How would you like to do that using only two lines of executable code and no third-party controls? It’s easy, using one of VB5’s little-explored

Special Effects with Forms 2.0 Designer

Forms 2.0 Designer provides a variety of special visual effects. Your forms can have flat, raised, sunken, etched, or bumpy background textures. You can also have the background picture tile, zoom, or stretch (zoom without distortion) to the form size. For background effects, check out the SpecialEffect property in the

Roll-Your-Own Decimal Entry Filter

Here’s an easy method for making sure your users enter only numeric data, and only one decimal point. First, place two Public procedures in a standard module. You can use Private procedures in a form if you’re only using it there, but you’ll lose easy portability for future projects. The

Easy Updates of Property Window for Multiple Controls

When you’re editing a series of controls, you can multiselect them either by clicking while holding down the Control button or by “lassoing” them with the mouse, then enter the appropriate data in the Properties window, and apply it to all selected controls. But what about those times when you

No more posts to show