May 9, 2000

OS System Calls

Question: How can I pass a member function of a class as a pointer in C (pointer type expected: void *)? Answer: You can’t pass a pointer to a C++ class member as void *. A pointer to member is not really a pointer, it’s a data structure. One way

Bit Fields and Memory Alignment

Question: Using Visual C++ 6.0, I recently attempted to create a structure to implement a data message that my application had to process. The following code segment produced unexpected results (names have been changed to protect the innocent): struct X{ BOOL field1 : 4; BOOL field2 : 2; BOOL field3

Clearing the Screen

Question: What is the “clear screen” function in C++, and which library is it in? Answer: Standard C and C++ don’t define a function that clears the screen. DOS and several other operating systems have a function called clrscr(). If you’re using DOS, you can find this function in “conio.h”.

Creating a Primary Index with Filter via Code

Question: On the Indexes tab of Visual FoxPro Table Designer dialog, you can define a Primary Index. How do I do the same thing through code in a FoxPro program? Answer: You need to use the ALTER TABLE command. What follows is the code to create a database called bobo

Pros and Cons of Extended Stored Procedures

Question: What are the pros and cons of creating extended stored procedures? Answer: The pros are that you can implement additional functionality and access data from DLLs from within SQL Server. If you need to do something that can be done only in C or C++, or if you have

Best Method for Inserting Rows

Question: From a database-efficiency standpoint, which is better for SQL when inserting new rows into a table: issuing ad hoc SQL statements in the form of “Insert Into…” or using the Add method on an ADO recordset object? Answer: In general, I recommend using stored procedures to insert records, unless

Memo Fields

Question: I have a memo field in a table, which has been scattered to memvar. I need to append a standard statement to the field once the user has completed entering data. I am trying to achieve the following effect: m.dispatchnote=m.dispatchnote+stdstatement Can you show me a way? Answer: What you

SQL Summary

Question: How do I print out all of the tables, the fields the tables contain, and the datatype of the fields in my accounting database (for report creation)? I am running Microsoft SQL Server 6.5 and have Crystal Reports 8 and Microsoft Access 2000. Answer: If you’re using SQL Server,