112 Posted Topics
Re: Are you confident that PositionToSave[1] is being set to a value which is within the bounds of the SAFEARRAY 2nd dimension? Have you checked with the debugger/cout statements. You say you're using a 2 dimensional array created in VB6. Was it created using SafeArrayCreate()? | |
Re: I'm not entirely sure whether you want to get a time and store it in a uint32 for later retrieval, or get the real time at any moment from a uint32. If its the former, it's possible, for simple hours,minutes,seconds over a 24 hour range you could use a union … | |
Re: It's only executed once, so that class would work as a singleton. An alternative technique which avoids the need to clean up the memory allocation is: [code=cpp] Singleton& Singleton :: getInstance() { static Singleton obj; return obj; } [/code] Pros and cons to each method. | |
Re: You haven't shown the signature for OnRecoEvent(), but it should be like this:- Declare the function in CSpeechDlg as: afx_msg LRESULT OnRecoEvent(WPARAM wp, LPARAM lp); and define it as: LRESULT CSpeechDlg::OnRecoEvent(WPARAM wp, LPARAM lp) { [INDENT]return 0; // or 1[/INDENT] } | |
Re: [QUOTE=Agni;849956]If you are passing the address of result then it's definitely a problem because you have not allocated 'result' on the heap. It's a local variable in the function Union and it disappears when we exit the function, if you try to access that address you can get run-time errors.[/QUOTE] … | |
Re: It's not very intuitive (to me anyway), but a reference to an array is declared: int array[10]; int (&ref)[10] = array; | |
Re: Don't forget your semi-colons: float fltBonus[B];[/B] float fltMoney[B];[/B] system ("PAUSE")[B];[/B] fltBonus = 0.02 * fltMoney[B];[/B] And case statements look like this: case 50.0: | |
Re: Wizard mode doesn't work quite like that. When you set wizard mode the sheet moves through all its pages using next/prev instead of tabs. So all your pages on the sheet are expected to be part of one wizard. If you want a wizard with 2 pages, and two other … | |
Re: Is your AdventureGame class using static variables? If so the new instance could be using some state information from the previous run. Check that these variables are properly initialised in the constructor, or convert them to non-static members if possible. The easiest way to get to the bottom of it … | |
Re: I would start by changing your radio resource styles from BS_RADIOBUTTON to BS_AUTORADIOBUTTON. The BS_RADIOBUTTON style requires you to do more of the work yourself. | |
Re: You should be pleased with your first attempt, it demonstrates threading nicely. There are some criticisms I would make: Your mutex isn't actually achieving much - totalNumber is only being updated by one thread. main() is just reading it, so no protection is necessary in this case. If you are … | |
Re: Items in a list box are not generally displayed in a fixed width font. So the length of the string will vary with different numbers, even though the number of characters is constant. You could modify the list box to use a fixed font, though you might not find that … | |
Re: [QUOTE=viji.sarathy;846521]How can i use the defined functions into the forms?[/QUOTE] Yes, the subject said that. How about giving us a bit of the background. Remember, nobody here was looking over your shoulder while you've been struggling with this problem. It's your first post, I'm going easy on you;) | |
Re: [QUOTE=Akis2000;845557]thank you for your help.... also you don't anwser to my main question.... my idea for this fuction , I mean my logic for this fuction is corect?? it give me the right output?? i try i and i think it's corect so...... I'm waitting for answer from one more … | |
Re: I don't see a problem with the code you posted. I even tried running the following:- [code=cpp] void getData(double **x, double **y, int n) { *x = new double[n]; *y = new double[n]; *x[0] = 2.6; } [/code] And the call:- double *xarr = NULL; double *yarr = NULL; getData(&xarr, … | |
Re: Declare maqr() like this: [code=c] int maqr(double* a[], int m, int n, double* q[]) { // and access the elements of a and q like this: double x = *a[0]; } [/code] | |
Re: I would guess that it's complaining because Parse() is not declared static. If you can arrange for Parse() to be static, AfxBeginthread() will be a lot happier. | |
Re: You're allowing the r value to get to 6 before you reset it. When it reaches 4 you already have problems because you access line[r+1], i.e. line[5], which doesn't exist. Try resetting when r > 3. | |
Re: In the constructor you are calling p.insert() where p is an object of class Set. Presumably you want p to be an object of class Node? | |
Re: Your passing by reference is fine for AverageNum(), but you do seem to be calling it before the file has been opened. Why do you have two calls to AverageNum()? | |
Re: [QUOTE=0o0;839362]bump! I can't figure out how to change gui from background worker![/QUOTE] No, you won't be able to update a GUI from a worker by calling it directly. You need to use message passing. i.e. call SendMessage() or PostMessage() to send a user defined message to the GUI thread. You'll … | |
Re: Tricky without seeing the code. Is there something different about the line format after 2000 lines? Try editing out 1500 lines and see if it falls over at the same place. Are you allocating memory dynamically and not releasing it? Have you allocated a static buffer which you are overflowing? | |
Re: I would define the 'parent' class before the 'people' class, and before 'people' I would add a forward declaration "class person;". | |
Re: You probably don't want to hear this. I don't know how to solve your problem and I get the feeling you're creating Frankenstein's monster. Passing around pointers which can point to different types is already giving you a headache. Your testing/debugging will be difficult and the poor swine that maintains … | |
Re: You seem to have two classes, Queue and mergeSort. mergeSort is derived from Queue. mergeSort is using a different struct for it's nodes than Queue, which isn't helping. I suggest you use struct Data for the nodes in both classes. As mergeSort is a Queue, in main() you'll be wanting … | |
Re: [QUOTE=viki0077;837761]1.1 Can a destructor, defined in a base class, be inherited by a derived class? 1.2 Can a base class destructor be overridden in a derived class? 1.3 Does an abstract class need a contsructor? [/QUOTE] You're clearly realising that the Constructors and Destructors are not your average method. Good … | |
Re: Well, if you knew the exact length of the 3 lines to be ignored, and you knew that this length would never change, you could use a file seek command to take you straight to the point in the file that you are interested in. However, that's making assumptions about … | |
Re: Your CharNode contains member "char data;" and you're trying to assign a string "First" to that char. That isn't going to work because "First" is actually a pointer to a null terminated array of chars and you're trying to say: char = pointer to char. If you want strings in … | |
Re: That snippet cannot work because, in func the compiler is unable to handle tap->par1. The details of class B are unknown at this point. The header file will compile, but the cpp file will need another include which contains the class definition for B. | |
Re: Just declaring your classes before they are used isn't always sufficient. E.g you declare class MoveList; before it is used in class RandomPlayer : public BackgammonPlayer but in this case you actually need the complete class definition of MoveList before the definition of RandomPlayer. If you were using a pointer … | |
Re: The vector manipulates the objects as StaffMembers, but in spite of that, they are still objects of the class you created them as, and GetType() should work fine. If GetType() always returns 's', I wonder if you've forgotten to make it public virtual in the base class? | |
Re: Just my opinion but the outline of the problem is that you have a Cluster which consists of a set of points and a centre point which you have somehow derived from that set. To me that is best modelled by a Cluster class containing a vector of points, and … | |
Re: [QUOTE]My concern is this, what is the life span of a state returned by new_state?[/QUOTE] I'm a little confused by that but I assume you meant next_state and not "new state". I don't see you allocating any memory, just moving pointers around, so presumably you allocate the states dynamically somewhere … | |
Re: By performing this calculation: 1836131903 + 1134903170 = 2971035037, you've set the top bit of a 32 bit register. That's still within the 32 bit range of the register but the "bgtz $t0, done" instruction is checking whether the register is greater than zero. The top bit is the sign … | |
Re: [QUOTE=kunal123;833892]hii, i cannot connect to the ms sql server.... i am using CDatabase class for connection the error message i am getting is what i hv posted above.. pls help me with the error message, even if i try to ping the server ip address it says timeout and fails.. … | |
Re: A semi-colon wouldn't go amiss at the end of this definition in maindef.h : template<typename t> class list {...}[COLOR="Red"][B];[/B][/COLOR] | |
Re: Surely you don't need to call: delete this; at the end of the destructor. You are in the destructor because delete has already been called. Calling it again creates the recursion. | |
Re: Yes, you are getting an array of pointers. Instead, declare your array of structs: foo test[10]; Now you have 10 foo objects and foo[0].myMember will reference the contents of the first one. To get a pointer you then use: foo* pFoo = &test[0]; which will give you a pointer to … | |
Re: Convert your integer to float before doing the division. e.g. int nIn = 50; float fOut; fOut = ((float)nIn)/100; | |
Re: If I understand you correctly, there are (at least) a couple of possibilities. You could delare a union which makes both data types available. Read your input into the char array in the order you want, then use the unsigned long for processing. [code=c++] union { unsigned long theLong; unsigned … | |
Re: Assuming you can get it to compile, your string comparison in: if(line1 == line2) is actually comparing the addresses of line1 and line2, not the array contents. Try using string objects to store the lines, or use an array comparison method such as strcmp(). | |
Re: If you just want to get numbers sorted a convenient solution is to use the STL sort() function. Look it up here [URL="http://www.fredosaurus.com/notes-cpp/algorithms/sorting/stl-sort-arrays.html"]STL Sort[/URL] However if you want to implement your own algorithm, well, there are several algorithms with pros and cons which would depend on your requirements. The [URL="http://www.cplusplus.happycodings.com/Data_Structures/code11.html"]quick … | |
Re: I don't see any obvious problem. Would you like to tell us what output you are getting and why you don't like it? | |
Re: If it's just the unary + operator you're worried about I'd say it doesn't have to do anything, so unless you want some non-standard functionality: void operator+(){} should be a good partner to your operator-. ...and just stop lying. | |
Re: Firstly the reference variables thing. In the context of parameter passing to functions, using a reference variable has the effect that any change to the variable inside the function will also change the variable in the caller. So, in this simple example, x is passed by reference and is altered … | |
Re: Your operator+ method is not actually a member of Distance. You need to define it as Distance Distance::operator+(Distance d) | |
Re: First the moan - as this is your 9th post you should know about code tags. Please use them, you'll get more help. Now some problems: GasPump::salePriceHigh() is being called with an uninitialised variable (gal2). GasPump::display() is only outputting the value for totalHigh so obviously won't be correct for low … | |
Re: It would help to see the code which is calling these methods. Are you trying to call get_name() from a constant CControl object? | |
Re: In your simDiceThrow() loop you output the dice values, but then calculate the number of even values by throwing the dice again. So the number of even values has no relation to the numbers previously output. The logic you actually need is to throw the dice n times, remembering each … | |
|
The End.