Forum: C++ Mar 31st, 2009 |
| Replies: 3 Views: 431 I think the two friend declarations need template <class T>
template <class T>
class Tree
{
...
template <class T> friend void buildExprTree(Tree<T> & expr);
template <class T> friend int... |
Forum: C++ Mar 28th, 2009 |
| Replies: 11 Views: 579 You can use const_cast, i.e.
Node * temp = const_cast<Node*>(this);
Maybe you could revise the 'constness' of the code (I did not look too closely). Perhaps read about Const correctness... |
Forum: C++ Mar 18th, 2009 |
| Replies: 9 Views: 498 There is a contradiction, in your first post you say that "Each file has: #include "include.h"". If enum.cpp actually includes include.h, that results in the error you described.
Assuming... |
Forum: C++ Mar 18th, 2009 |
| Replies: 23 Views: 1,029 Now remember the second parameter to write(), that specifies how many bytes are written.
PS. Maybe you could try to re-post your code |
Forum: C++ Mar 16th, 2009 |
| Replies: 23 Views: 1,029 It seems that you are desperately trying various ways to write the file.
Maybe relax and try to master e.g. a binary .pnm file of a very small size, say 2x2 pixels hence being easily viewed in... |
Forum: C++ Mar 10th, 2009 |
| Replies: 4 Views: 554 Read about When should my destructor be virtual? (http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7) |
Forum: C++ Mar 10th, 2009 |
| Replies: 7 Views: 1,006 The function prototype for ON_MESSAGE() is
afx_msg LRESULT memberFxn( WPARAM, LPARAM );
Ctry_ENTERDlg::OnBnClickedButton1 does not match, so you might add a new member function which handles... |
Forum: C++ Mar 8th, 2009 |
| Replies: 6 Views: 570 If the stream object is in error state, then you also need to call clear() in order to make the object functional again. Could that be the reason in this case? |
Forum: C++ Mar 8th, 2009 |
| Replies: 3 Views: 519 As soon as the map goes out of scope, its destructor takes care of destructing all the vectors, whose destructors in turn destruct all the strings. So it all happens automagically (as long as you are... |
Forum: C++ Mar 6th, 2009 |
| Replies: 8 Views: 1,073 resource.h is not the place to define _WIN32_IE. Do it instead above the #includes, i.e.
#define _WIN32_IE 0x0301
#include <windows.h>
#include <commctrl.h>
Or alternatively in the... |
Forum: C++ Mar 6th, 2009 |
| Replies: 8 Views: 1,073 In your project, #define _WIN32_IE to at least 0x0300.
InitCommonControlsEx() takes a pointer to a INITCOMMONCONTROLSEX struct. You are not using the function correctly ... |
Forum: C++ Mar 6th, 2009 |
| Replies: 2 Views: 230 A typo has slipped in ... it should be localVariable. |
Forum: C++ Mar 6th, 2009 |
| Replies: 7 Views: 1,006 Seems that I misunderstood the problem. Anyhow, the CMyEdit class' code that you have should capture the Enter key.
Maybe you don't have the following in the dialog class implementation
... |
Forum: C++ Mar 6th, 2009 |
| Replies: 7 Views: 1,006 That functionality can be achieved by simply making sure that:
the first button (only) has the 'default button' -option checked
the first edit box does not have the 'want return' -option... |
Forum: C++ Mar 4th, 2009 |
| Replies: 3 Views: 526 See GetExitCodeThread() (http://msdn.microsoft.com/en-us/library/ms683190(VS.85).aspx) |
Forum: C++ Mar 3rd, 2009 |
| Replies: 2 Views: 694 Don't allocate using the operator new, use _aligned_malloc() instead to have the data properly aligned. |
Forum: C++ Mar 3rd, 2009 |
| Replies: 5 Views: 445 One approach would be to
generate a default MFC-based add-in
study it so that you understand how things work
strip off all MFC/AFX -based stuff, converting the add-in to a standard DLL... |
Forum: C++ Feb 27th, 2009 |
| Replies: 4 Views: 668 To get 'non-destructive writes', open the file specifying also the ios::in mode. |
Forum: C++ Dec 5th, 2008 |
| Replies: 6 Views: 484 It appears as if you might have stumbled upon the virtualization feature of Windows Vista. Try looking it up on the MSDN. |
Forum: C++ Nov 28th, 2008 |
| Replies: 5 Views: 1,186 You can circumvent that by ...
int main()
{
...
switch(option)
{
case 'h':
case 'H':
{ // new scope begins here ... |
Forum: C++ Nov 23rd, 2008 |
| Replies: 10 Views: 1,854 Wouldn't it be easiest to add 'standard' ON_UPDATE_COMMAND_UI handlers for those two sub-menus, i.e. you'd have something along the lines of:
ON_UPDATE_COMMAND_UI(IDM_SUBMENU1, OnUpdateSubmenu1)... |
Forum: C++ Nov 20th, 2008 |
| Replies: 12 Views: 981 Hmm, you have to understand that char editControl_Content[2]; allocates space for two chars.
The array indexes start from zero, meaning that the only indexes you are allowed to access in this case... |
Forum: C++ Nov 20th, 2008 |
| Replies: 12 Views: 981 You are not getting the window text properly, it should be
char editControl_Content[2];
// the following gets one char into editControl_Content[0] and sets
// editControl_Content[1] to '\0'... |
Forum: C++ Nov 7th, 2008 |
| Replies: 12 Views: 1,300 Well, by doing the following ...
...
background = load_image("background.bmp");
if(background == NULL)
{
// load_image() failed ...
cout << "load_image() failed, error: " <<... |
Forum: C++ Nov 6th, 2008 |
| Replies: 12 Views: 1,300 Assuming that SDL is unable to load the image, you might place a call to SDL_GetError() (http://sdl.beuc.net/sdl.wiki/SDL_GetError) immediately after the line:
background =... |
Forum: C++ Oct 27th, 2008 |
| Replies: 2 Views: 403 Try with these changes
//CUSTOMERDLL.H
#ifndef DllH
#define DllH
#include "customerForm.h"
extern TCustomerF* DllCustomer;... |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 434 I think you are using a 32-bit toolset (VS Express) and trying to link with the 64-bit version of libmysql.lib.
The 32-bit version of libmysql.lib comes with those missing symbols, what you have is... |
Forum: C++ Oct 16th, 2008 |
| Replies: 6 Views: 471 Perhaps your intention was to replace also a '\v' with a space but you forgot to do it? |
Forum: C++ Oct 1st, 2008 |
| Replies: 11 Views: 1,100 Which compiler/OS are you using?
The (modified) code worked for me (Visual Studio 2005), but NOT with GCC 3.4.2. |
Forum: C++ Oct 1st, 2008 |
| Replies: 11 Views: 1,100 A couple of things
1) When opening the file, in addition to the ios::out|ios::in flags, specify one of: app, ate or trunc (http://www.cplusplus.com/reference/iostream/fstream/open.html) flag.
... |
Forum: C++ Oct 1st, 2008 |
| Replies: 11 Views: 1,100 One fix to the reading problem is to re-open the file, or alternatively you might implement
something similar to seekg() (http://www.cplusplus.com/reference/iostream/istream/seekg.html) to set... |
Forum: C++ Sep 30th, 2008 |
| Replies: 19 Views: 2,037 I think you are after ...
typedef List<String^> Vec1;
typedef List<Vec1^> Vec2;
Vec2 List1;
for( int j = 0; j < 1000; j++ )
{
List1.Add(gcnew Vec1()); |
Forum: C++ Sep 27th, 2008 |
| Replies: 26 Views: 2,959 Use #include <time.h>, and use clock_t and clock() instead of std::clock_t and std::clock(). |
Forum: C++ Sep 4th, 2008 |
| Replies: 13 Views: 1,092 Hmm, just a thought .. how about changing one line of the signature to:
cout << "Hi there!" << "I'm a non-standard-compliant C++ coder!";
;) |
Forum: C++ Sep 3rd, 2008 |
| Replies: 5 Views: 428 It appears as if you might find already deleted students, because of the ...
for (int n = 0; n < MAX_STUDENTS; n++)
{
if (strcmp(delStudent, students[n].ID) == 0)
{ |
Forum: C++ Sep 3rd, 2008 |
| Replies: 5 Views: 512 I think you'd want to have the string and the newline the other way around, i.e.
text += Dummy2 + System::Environment::NewLine; |
Forum: C++ Aug 29th, 2008 |
| Replies: 12 Views: 1,223 Simply put, it invalidates the view so that its OnDraw() function gets called.
By the way, the OnDraw() leaks memory since you are not deleting the CRect that you allocate there. |
Forum: C++ Aug 29th, 2008 |
| Replies: 12 Views: 1,223 I'm not quite sure what you actually expect to happen, but I think you maybe want to add the RDW_INVALIDATE flag to the RedrawWindow() call. |
Forum: C++ Aug 28th, 2008 |
| Replies: 10 Views: 1,783 If it is TRUE, then it worked, else not (i.e. it is FALSE).
MFC provides the VERIFY() macro, which you might find useful, i.e.
VERIFY(button1.Create(_T("HI"), WS_CHILD | WS_VISIBLE |... |
Forum: C++ Aug 28th, 2008 |
| Replies: 10 Views: 1,783 You are not checking the return value of Create(...), so you are unaware of the error.
Override the view's OnInitialUpdate() method and create the button there. At that point the view is readily... |