March 25, 1999

Strings

Question: How can I convert integers to strings? I’m using a gcc compiler under Solaris 2.6. itoa, which I used in VC++, doesn’t work. By the way, how can I write strings on a graphic canvas using the GLUT library? Answer: I haven’t worked with gcc, but if itoa does

Void Pointer and -> Operator

Question: I am a beginner to C++ and have looked into several resources but still have some questions. Can you tell me what a void pointer is and what it is used for (implementation)? Also, what is the -&#gt; operator? Answer: A void pointer is simply an untyped pointer. That

Command Line Parameters

Question: I want to write a DOS program that takes command line parameters and uses them in the program.For example, if the program was comline.exe and you typed in the command line: comline one two three the program should display something like: Parameter 1: one Parameter 2: two Parameter 3:

MFC vs. VB?

Question: I am not new to C++, but I am new to VC++. The question I have pertains to the usability of MFC versus the ease and power of VB. I was told recently to skip anything pertaining to MFC when getting up to speed on VC++. They noted if

Short Vs. Int and Number Conversion

Question: 1) What is the difference between a int and a short variable? 2) How do I convert a number to binary from decimal? Answer: 1. Depending on the platform, some C compilers will implement an int as a short (16-bits) while other compilers will implement an int as a

Displaying a date

Question: I have a date stored as an integer — days from 1/1/1900. iis there an algorithm out there to display the day, month, and year? Or is there an easy way to do this? Month seems to be the real problem because they each have a different number of

More about sizeof() operator

Question: I’m using the sizeof() operator to find the length of my integers just like the Q&A section said, but it consistently returns a 4 regardless of integer length. What could be causing an error like this? Answer: I’m more puzzled trying to determine exactly what it was you were

List Files With FileSystemObjects

One of Visual Basic’s handiest functions is the Dir function, which allows you to find all the files with a given filespec. VBScript does not have an identical function, but it does provide a way to list all the files in a directory. With this list, you can then filter

Display the Stack Trace

The stack trace is a useful debugging tool that you’ll normally take advantage of when an exception has been thrown. It provides information on the execution history of the current thread, displaying the names of the classes and methods within those classes that had been called at the point when