devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

Using strstream for ‘incore’ binary I/O

Question: Can I use strstream functions for incode I/O,i.e. writing to memory just as if it were binaryinput/output to a file? Answer: You can use it to do incode input

Constructors and virtual functions

Question: I have been doing some programming in C++ and recently decided I would try some Windows programming with the Microsoft Foundation Classes. This isn’t a question about Windows but

Clearing character arrays

Question: How do you clear a character array? Answer: You can use the standard C library memset function. Here is an example:void foo (){ char t [20]; cin >> t;

Declaring a bit field for a variable

Question: Is there a way to explicitly declare the number of bits to allocate to a specific variable? For example, can I declare an integer that would be stored in

Helpful C/C++ newsgroups

Question: Do you know of any good C/C++ mailing lists? I’m a computer science major and I’d like to join one. Answer: I am not aware of any mailing lists

How portable is C++?

Question: How portable is C++ as a programming language (in terms of different operating systems andhardware)? Answer: C++ is a fairly new language that until recently did not specify anystandard

Using self-defined libraries

Question: I am using Borland Turbo C++ 3.1 and I can’t figureout how to use my self-defined libraries. I’ve used”#include” but I get an error every time I try touse

What to do with overload arguments

Question: Which arguments do you receive when you overload . and -> , and what do you do with the arguments? I know that for overloading [] you receive the

What is pure virtual function?

Question: Can you explain and give me examples of pure virtual function? What is the difference between pure virtual function and virtual function? Answer: A pure virtual function is a

String tokenizing

Question: I often need to split a string into a number oftokens based on delimiters specifiedby the user. I would appreciate information on how to tokenize a string in a

Manipulating and using large integers

Question: In several programs, I need to use integers larger than those that can be held by unsigned long ints. I need to be able to multiply, divide, and mod

File handles/pointers

Question: In C, I use the FILE *filename. As a beginning C++ programmer, I open streams for reading and writing inside the main() function, but when I try to work

Compilers: Which is best?

Question: Which model of C/C++ compiler offers the best value for a beginning programmer?(It must be ANSI C compatible.) Answer: The GNU G++ compiler. It’s free, ANSI C compatible and

Possible to read integers as integers?

Question: Is it possible to read integers from a file as integers, or must I read them as strings and then convert them to integers? Answer: In C++ the streams

Friend class and function

Question: I need to know what the class or function called “friend” is. My teacher explained it in class, but I don’t quite understand how to call it and declare

Storing strings in a char array

Question: This is actually a simpler form of the real problem I am dealing with. I have a array of char like so:char name[20];Then, I try to put a string

VC++ 5.0 and STL predicates

Question: How can I provide my own predicate for the list::sort method in Visual C++ 5.0? The method appears to require that any function object passed must be derived from

Reference Counted Implementation

Question: For a reference counted implementation, how is the operator+= member function coded? The function receives (const String & rhs) and returns String &. The returned String &

Memory allocation at compile time

Question: Consider the following piece of code:#include /* C++ String class */static String s(“hello”);main() { // … your code s += ” world”; // …}Question: String class uses the new

Inheritance design

Question: Suppose I’ve got the following class hierarchies:Surface_PlotContourSurface_Plot, child of Surface_PlotSurface_DataGridSurface_Data, child of Surface_DataSurface_Plot contains a Surface_Data object, ContourSurface_Plot contains a GridSurface_Data object.What is the most elegant way to arrange

Inheritance and parameter pushing

Question: Why do I need private inheritance in C++?Is it true that (in C++) function parameters are pushed onto the stack from right to left? If so, why? Answer: Use

Compilation Warning

Question: I got a warning when I compiled my C++ program onHP-UX:Line 219: Warning: Namespace is a future reserved keyword (215).What does this mean? Answer: It means exactly what it

reading input field numbers

Question:   Answer: JavaScript can be used to access values in web form input fields. This is possible because JavaScript treats input fields as objects with several properties. One of

Persistent Cookies with JavaScript

Question: How can I write a cookie in one page and then read that cookie in another? or alternatively pass data gathered in one page (not a remote!) and then

undefined vs. null

Question:   Answer: You are probably familiar with a special value in JavaScript called null. This is a value you can assign to a variable when you want to indicate

Representing Numeric Values in US Currency Format

Question:   Answer: Many people have been asking how to do this. Since JavaScript does not have built-in methods for converting numbers to currency-formatted strings, the only option left is

Data Retrieval to a ListBox

Question: I need to know how to retrieve multiple data and put it in a listbox. This data is also indexed to another database by it customer id. I can

SQL Date/Time Table Selection

Question: I have a database with a field set to Date/Time.My project has a variable that is of type Date.In a text box it displays 04/21/97. I cannot get the