Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Search the Tips
Tip Bank > C++ > Debugging

Debugging - Page 5

81-100 of 275     Previous     Next
Stacks to Strings Conversion
by Manoj K.
Sometimes it is useful to be able to capture the output from a stack dump, redirect it to a string, and then, perhaps, to a window. ...
Patch for Divide-By-Zero Error
by DevX Pro
We are getting a divide-by-zero error running FoxPro for Windows 2.5 on a Novell server on the network on an NT workstation. Can I use the patch in version 2.5?
Using the Assert Macro
by DevX Pro
I am not sure if it is good when I use the assert macro in the following code: int sum(int number) // Precondition: number => 1 // Postcondition: return sum from 1 to n terms { assert(number >= 1); int total = 0; for (;number >= 1; number--) { total = total + number; } return total; } What do you think?
Copying Part of a String
by DevX Pro
I have a little problem which I can't solve. I will give the question with an example. I'm working with Excel. In a cell the string "100dpi.txt" is written. Is it possible to copy a part of this string "100dpi" to another cell? How should I do this? In this example the "part of the string" contains six characters before the dot. This part of the string can vary from one to eight characters.
Maximum Number of Objects on a Form
by DevX Pro
Is there any way to get more than 255 objects on a VB form?
ServerSocket Port Binding Error
by DevX Pro
My Java server compiles perfectly, but when I try to run it on my machine I get an error when it tries to open up the ServerSocket on port 2525. I have tried it on another machine and it works fine. It also worked on my own machine the first few times I tried it.
Use TreeView Control With Checkboxes
by Gerardo Villeda
When the NodeCheck event triggers, you receive as a parameter the node that was checked. Say you need to do some validation and uncheck the node when there's an error. You set Node.Checked = False, ...
Menus Using Virtual Functions
by DevX Pro
What is giving me a redefinition of CMenuItems class error in this code? //cmenu.h class CMenuItem { public: char title[81]; virtual void Do_Command(void)=0; }; //********************* //CMDS.CPP Defines and initializes menu commands. #include #include #include "cmenu.h" class CMenuBell:public CMenuItem{ void Do_Command(void); }; class CMenuSaying:public CMenuItem{ void Do_Command(void); }; class CMenuAdd:public CMenuItem{ void Do_Command(void); }; void CMenuBell::Do_Command(void){ putc('\007',stdout); // "\007" rings a bell } void CMenuSaying::Do_Command(void){ puts("If you know the meaning of the universe,"); puts("Make the sound of one hand clapping."); } void CMenuAdd::Do_Command(void) { double x,y; printf("Enter a number: "); scanf("%lf",&x); printf("Enter a number: "); scanf("%lf",&y); printf("The total is %f.", x+y); } int num_commands; CMenuItem *commands[20]; void Init_Commands(void) { commands[0] = new CMenuBell; strcpy(commands[0]->title, "Sound a bell."); commands[1] = new CMenuSaying; strcpy(commands[1]->title, "Print a message."); commands[2] = new CMenuAdd; strcpy(commands[2]->title, "Add two numbers."); num_commands=3; } //************************ //Main.cpp #include #include "cmenu.h" #include "CMDS.cpp" extern int num_commands; extern CMenuItem *commands[]; void main(void) { int i, sel; Init_Commands(); do { puts("\nMENU:\n"); for (i=0; ititle"); printf("\nEnter a selection: "); scanf("%d", &sel); if (sel>0 && selDo_Command(); } while (sel
Default Button Prevents Firing of Validate Event
by Gordon Lawson
VB6 introduced the Validate event as a way to handle field-level validation without using LostFocus, which doesn
Where Are Exception Objects Stored?
by Danny Kalev
Consider the following ...
Rules of Thumb for Designing Exception Classes
by Danny Kalev
< ...
Passing a Variable to a Compiled Program
by DevX Pro
I am calling an .FXP from a batch file, but would like to pass a variable. Am I able to do this? How would FoxPro recognize it?
Maintain Call Stack for Error Tracing
by Harvey Flaisher
I program all reusable components into DLLs or OCXs. To provide a consistent error-handling technique across all my projects, I use the Raise method of the Err object in all these components and ...
Hard-Code Your Watch Points
by Robert A.
Insert Soft Breakpoints
by Janakiraman Sattainathan
If you want to step through the code behind a ...
Query is not Updateable Error
by DevX Pro
When trying to run the SQL statement, I get this error but I don't know what it means: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. /cgi-bin/action.asp, line 34
Ambiguous Operator Error
by DevX Pro
My small program (see below) below compiles and runs correctly on one machine and generates the following error on another: 'operator Both computers are running Windows NT 4 Service Pack 4, Microsoft Visual Studio C++ v.6. Could you please tell me where the source of this problem could be? Tools | Options | Directories Tab and Tools | Options | Help System Tab of MS Visual C++ Studio have the same settings on both computers. */ #include #include #include using namespace std; class Event{ friend ostream &operator pq; pq.push(e1); pq.push(e2); while(!pq.empty()) { cout error C2248: 'eT' : cannot access private member declared in class 'Event' see declaration of 'eT' error C2248: 'pT' : cannot access private member declared in class 'Event'
File Locations
by DevX Pro
I have set Home as C:\MyApp in Project Information. VFP has no problem finding the project, but when I do a build and, while running, click a link to a form, it wants to look in the VFP directory or, since I put SET DEFAULT TO C:\MyApp in main form Activate code, it wants to look there instead of in: C:\MyApp\Forms. Doesn't VFP know to look in a Forms subdirectory for a form? I want the application to find each component (form, database, report, etc.) based on setting a single "Application Home Directory" so that when I deploy it to the target PC, I only need to change a single location setting. Is this possible? I want the application to find each component (form,database,report,etc.) based on setting a single 'Application Home Directory' so that when I deploy it to the target PC, I only need to change a single location setting. Possible?
Compiler Warnings with STL Map Containers
by DevX Pro
Using even the most basic default constructor, such as " mapm; " , causes a debug error creating huge compiler warnings in Visual C++ and MS Visual Studio 6.0. That one line alone causes 6 warnings and the small sample program below ultimately creates a total of 19 warnings. The code executes without further incident but the unresolved warnings trouble me. In essence, the compiler warnings indicate that the debugger continues to append class names into long command lines that eventually exceed the 255-character limitation. The suggested resolution, substituting a 1-character name for the class name during debug time, does not work. Is there a fix? #include #include #include using namespace std; class classic { long account; char descrip[50]; public: classic (); classic (int yr, char *who_or_what); ~classic (); void show_list (); int get_val () const; bool target (int low, int hi); friend ostream &operator= low && account (const classic &item1, const classic &item2) { return item1.get_val() > item2.get_val(); } bool operator== (const classic &item1, const classic &item2) { return item1.get_val() == item2.get_val(); } bool operator!= (const classic &item1, const classic &item2) { return item1.get_val() != item2.get_val(); } // --------------------------// int main() { int accts = 0; cout line; // Fill the map line.insert( pair( long(10000), classic(10000, "Sandal Accounts")) ); line.insert( pair( long(10500), classic(10500, "Slipper Accounts")) ); line.insert( pair( long(21000), classic(21000, "Women's Shoe Accounts")) ); line.insert( pair( long(31000), classic(31000, "Men's Shoe Accounts")) ); line.insert( pair( long(50500), classic(50500, "Boot Accounts")) ); // Display map data map::iterator p; accts = line.size(); cout second.show_list(); cout second.show_list(); cout second.show_list(); p++; } return 0; }
Data Source Name Not Found Error '80004005'
by DevX Pro
What does this error message mean? Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /SampleProject/default.asp, line 14 Here's the code I created in Visual InterDev: : : : : Conn.Open "Concerto" strSQLStmt = "SELECT * from TVChannels" RS.Open strSQLStmt, Conn %>
81-100 of 275     Previous     Next
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date