May 23, 1999

Passing a parameter to an external function

Question: Can I pass the address of a PowerBuilder function as an argument to an external function located in a dll? The dll documentation shows that it expects the address of an error function of the form “void my_function(void *ptr)” as a parameter. Answer: You cannot do this directly in

64-bit integer support

Question: How can I support 64-bit integers on a 32-bit system? I need to do division on numbers exceeding 4.3 billion. I have the resaults in a char value, and would like to convert the value to a 64-bit integer, if possible. If not, do you know of a way

Copy objects

Question: Assume that you have a class Distance and two objects dist1 and dist2. You have initialized the object dist1. Now you do: Distance dist2(dist1) to create a copy of dist1into object dist2. Have all members of dist1 been copied intodist2? What does not get copied? Answer: That depends on

Data Files Help

Question: I am teaching an introductory C++ course at thehigh school level. My textbook briefly coversdata files–sequential access–but doesn’t provide many examples of how to write/read multiple variables. Where would be a good place to look for example programs? Answer: I suspect that the reason your textbook doesn’t go into

DOS to Windows Conversion

Question: How do I convert a DOS file into a Windows program? Answer: Unfortunately, not very easily. While DOS programs will run under Windows and you may also want to look into Windows console applications (which act pretty much like a DOS application running under Windows), the structure of a

Resizing Dynamic Array

Question: int num = 50;int **stuff;stuff = new int* [num];for (int i = 0 ; i < num ; ++i) stuff[i] = new int [num]; The code above is copied from another question. Say the above array is a matrix where each row has a number of columns, how do

Derived Classes

Question: Functions are inherited easily. But if you have a variable in the base class and you want have the same variable but with a different type in the derived class, what to do then? for instance: class A{…….}class B{…….}class Base{ A MyClass;}class Child:public Base{ B MyClass;} What happens in

Visual C++ Check/Radio Buttons

Question: How does one go about disabling/enabling buttons and check boxes in dialogs based on the state of other buttons or check boxes? The controls in question are of the MFC class CButton and are created as part of a CDialog object. Answer: I would write a common routine that

Far pointers in VC 5-6.0

Question: I was trying to do some direct memory stuff (writing to the DOS console buffer or a graphics screen) using my Visual C++ compiler. Unfortunately, the compiler is telling me that “far is an obsolete keyword.” What is the solution to get to absolute memory addresses outside of the

No more posts to show