devxlogo

April 3, 2001

Converting a Hexadecimal String to int

Suppose you need to convert a string containing a hexadecimal value to int. Although you can use a std::stringstream object for this purpose, it’s worth noting that good old C

The Lifetime of Temporary Objects

Temporary objects, or unnamed objects, are created as a result of expressions requiring a temporary object or when the user instantiates them explicitly. If the temporary object is not bound

Detecting end-of-file in Input Streams

std::istream and std::ifstream objects define the eof() member function which returns true when the stream object has reached the end of a file. Note that at least one read operation

Nested Comments

Standard C and C++ don’t allow comments to be nested. Thus, the following code snippet is ill-formed because it has one /**/ comment nested within another pair of comments: /*int

How to Read NT System Properties

A direct method or class that will allow you to read NT system properties does not exist. However, it can be done as follows: Write a simple batch command file

Customizing an Editable JComboBox

A previous tip explained how to change the appearance of the ‘list selection’ cells of a JComboBox by setting the attributes of the JComboBox object’s ListCellRenderer.However, the ListCellRenderer controls the

How to Use Maps Effectively

The java.util.Map interface is the root interface of the map hierarchy. Interestingly, it doesn’t extend the familiar java.util.Collection interface. It facilitates storage, retrieval, and manipulation of key-value pairs.The popular implementations