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

String formatting

Question: Is there a function that will format a string for number or, say, $$ display? For example: format 1000000 to 1,000,000? Answer: No, the C standard has no such

C++ equivilant of Basic MID$

Question: I need to test for a certain char in a char array.For example, in BASIC I would have: if mid$(string,1,1) = “`” then blah blah blah…. How would I

Sorting in a ListView

Question: I would like to know how to program a Custom Sort procedure on a ListView in Borland’s C++ Builder. Answer: Normally, the ListView control will sort items automatically for

Return type _Cdecl

Question: I have seen that in many of the header files in C++ the return type is _Cdecl. For example, in complex.h, we have the following: friend complex _Cdecl acos(complex&)

Quick sort

Question: I have pseudocode for a quick sort. I know how to implement it in Pascal. Is there simple code for quick sort in C++? How can I find other

External file execution

Question: How can I code a Visual C++ program that will execute a DOS bat file? Or any other executable file, for that matter? Answer: Use the system() function. This

Functions and parameters

Question: I know this may sound like a dorky question, but can you explain to me?as if I were a little kid?what are functions, and why and how are parameters

Pointers to member functions

Question: I am having lots of trouble calling a class member function pointer that is declared within the same class. So far the following compiles: class testClass {public: void (testClass::*ptr)();

Integer lengths

Question: What function gives the actual length of an integer or long integer? For instance, 8 is 1 long, 12345 is 5 long, etc. Answer: Use the sizeof() operator to

Performance—C vs C++

Question: What are the performance tradeoffs of using C++ instead of C? Are there any ways of overcoming these tradeoffs? Answer: In general, C++ is every bit as efficient as

Adding to the front of an array

Question: I have to read in integers and be able to add them to the front of the array. How do I do this? Answer: You can either use the

Windows programming

Question: We use NT 4 WS as the client to our PeopleSoft (Oracle) application, and we need to pick off the information contained on the panel fields. We can easily

Rebooting NT from VB

Question: How do I reboot (with an option to force) inside of Win NT? I know about the ExitWindowsEx API call, which works fine in Windows 95, but unfortunately this

File version information under NT

Question: I am using the GetFileVersionInfoSize, GetFileVersionInfo, and VerQueryValue APIs to get the file version of third-party applications. In all cases, GetFileVersionInfoSize returns a large number, but when I query

Output to I/O port under NT 4.0

Question: Please kindly advise how to output to a PC’s I/O port address: &H158 using Visual C++ under NT 40. For your information, we used to use outp() using C

FTP

Question: If I ftp to an AS400, I can run a program on it by typing quote rcmd call . Is it possible for me to do the same thing

Automatic logon problems in NT 3.51

Question: We are running a SCADA package on an NT 3.51 machine at a mine. Since we often have power failures, the PC reboots itself and then requires the operator

Scheduling A Visual Basic app on NT

Question: I have a VB app that was running on Windows 95 and using the scheduler included with Microsoft Plus. All was well. Now our company is switching to an

Use Register variables to enhance performance

The C/C++ register keyword can be used as a hint to the compiler that the declared variable is to be accessed very often during program execution, and hence, should be

Static member function

A static member function in a class can access only other static members of a class or variables which are not members of its class. It can be invoked even

Retrieving actual object type in run-time

C++ supports Run-time Type Identification (RTTI), which enables detection of actual object type during program execution using the built-in typeid() operator. Here is an example: //file: classes.hclass base{ base(); virtual

Global objects construction and destruction

In object-oriented programming (OOP), global objects are considered harmful. Particularly in C++, there’s even more reason to think twice before using them: a global object construction occurs before a program’s

When is a mem-initializer required?

A const member or a reference member cannot be initialized within an object’s constructor. Instead, they must be initialized in the constructor’s member-initializer list. Conceptually, mem-initialization takes place before the

Uses of an anonymous union

Unions are used to minimize memory waste. For example, consider the following database-transaction class used to update a person’s data. The key can be either a unique ID number or

Datawindow print dialog

Question: How can I get the Windows 95 print dialog box todisplay instead of the print setup dialog usingprintsetup()? Answer: You have to build your own custom dialog window. The

Text files with MFC

Question: I have been reading Visual C++ 5 in 21 Days while trying to learn how to use the Visual C++ user interface, and I have been trying to find