556 Posted Topics
Re: Thats because line 59 is the first time in the file that the identifier `sortVecByCreditsAscending` is mentioned so as far as the compiler is concerned it is undeclared, hence the error. Line 61 and 62 are wrong, 61 declares a function and 62 returns from main, not what you intended. … | |
Re: You have not read the documentation carefully > SND_NOSTOP > > The specified sound event will yield to another sound event that is already playing in the same process. If a sound cannot be played because the resource needed to generate that sound is busy playing another sound, the function … | |
Re: This is all platform dependent, that is different platforms may do different things, however, the "hello world" would not be stored in the read-only code segment, it is data not code so most likely it would be stored in the read-only data segment. The initial value for foo, 1, would … | |
Re: Clearly it is running since it "exited" just not in the way you intended. Build and run in debug mode, if you are getting some sort of exception it should stop you where the code is going wrong. Alternitively step through the code in the debugger so you can locate … | |
![]() | Re: Floating point values are approximations, and any manipulation of a floating point number is like to produce an approximate value that may not be what pure mathmatical logic would suggest the answer should be. For example take float i=0.3; i += 0.000005 * 30000000; i -= 0.000005 * 30000000; Logic … |
Re: Basicall you can't do what you are trying to do at line 8. You can not compare a value to an array of values, you have to do the comparison individually, or in this case have a string containing your hexadecimal characters and use a string search function (such as … | |
Re: Line 41 to 45, since you don't change d, e or phi in the loop and since d is always 1 the value of s is constant with-in the loop and if e % phi is not equal to 1 the loop will never exit. | |
![]() | Re: typedef int (*HIG) (int,int); In this statement `HIG` is the name of the new type, the type it is defined to is `int (*)(int,int)`. This statement is defining a type that is a point to a function that returns int and takes 2 integers as parameters, as always the syntax … |
Re: It's not at all clear what the issue might be, you are clearly using a very specialised library. I would suggest some techniques used in a general approcah to any problem: 1. Try running the software in a symbolic debugger, when it gets to the point of not responding (assuming … | |
Re: You can't implement what sizeof does because it is done by the compiler at compile time, the only way to get sizeof behaviour is to use sizeof. It you pass an array to a function void function1(int* parameter) { // Some code using parameter but element count in parameter not … | |
Re: 1. Don't use arrays for a co-ordinate array use a vector of a co-ordinate class class coordinate { public: // Constructors etc coordinate(); coordinate(double lat, double lon); coordinate(const coordinate& cpy); ~coordinate(); // Getters setters double getLat() const; double getLong() const; void setLat(double value); void setLong(double value); void setLatLong(double lat, double … | |
Re: Do you check your return value from strchr for NULL? I ask because you search for '*' but you string does not appear to contain any *. Also you do not appear to be assigning any memory to the pointer nameBuffer before you copy into it. You need something like … | |
Re: [QUOTE=nbaztec]Of course strlen() returns the number of chars - NULL but in a string indexing starts from 0. So str[11] is sufficient to hold 11 characters plus 1 null char. As 0-11 is 12 characters in all[/QUOTE]No very VERY wrong. strlen does not return the size of the array holding … | |
Re: Most likely cause is that AIwords is either NULL or invalid so when you dereference it to get the name member you get a SIGSEGV (memory error). | |
Re: sscanf is not up to dealling with all those different formats. You would be better off searching the string for // and then checking to see if it is followed by a digit and then if it is using atoi or strtol to convert that to a binary value. | |
Re: Yes firstly don't have a text box for number it is entirely superfluous when you can just design the interface so the user can enter any number of values and the software can read that number later. Use a list box, a text box and a button labeled "Add". When … | |
Re: lol, OK so I wasn't seeing the ads because of NoScript but I was getting the fade effect which was highly confusing until I found this thread. I had seen the "No Ads" user profile option but for some reason had assumed that it wouldn't work since I'm not a … | |
![]() | Re: At line 12 of you code where you create the new node there seems to have been nothing done to check that the value produced is a valid index for the tileMap array. For example if newParent->x == 0 then on the loop iterations where x == -1 the result … ![]() |
Re: Because you return s from mkUpperCase which by the time the function has finished running points to the termintor of the string. If you print name as well as the return from mkUppercase you can see the function actually did it's job. mkUpperCase should store and return the input pointer. | |
Re: If you happen to want to override the default behaviour of new/delete which you might to monitor allocations or for a number of other reasons but you still want to allocate the memory returned from the heap then you will need malloc/free to implement your new/delete. | |
Re: Because you have passed the vector into insert by value. When you pass by value a new copy of the variable (whatever type it is but vector in this case) is made for the lifetime of the function and gets deleted when the function exits. So in your code when … | |
Re: In operator= (lines 41 - 46) you create a temporary stack which gets deleted as soon as the function exits. This is surely not what you intend, I imagine you want to push onto the current stack don't you? You are already in side a member of stack so you … | |
Re: You have your declarations of new and delete wrong, new is declared like this `void* operator new (std::size_t size) throw (std::bad_alloc);`, similarly delete also has throw statement you have missed out, check the documentation of these functions. Additonally you have only provided you own implementation of a single version of … | |
Re: strcmp - compares 2 strings up to their zero terminator strncmp - compares 2 strings up to a limit of either their zero terminator or a supplied count of characters. This is useful if you happen to want to look for a specific substring of characters within a larger string. … | |
Re: It is not so much that there is problem with your euclid function as the fact that you don't call it in add/subtract/multiply/divide thus break OOP rule number 637 A method worth implementing is worth invoking. Not forgetting 638: A method worth invoking is worth implementing. and 639: No method … | |
Re: Should work fine but why not just divide by matrix1.size()? | |
Re: You use the value of r1 at lines 8, 10, 11 and 12 (and 9 if you uncomment it) before initialising or assigning it (which you do at line 13). Using an automatic scope variable without initialising it is undefined behaviour. There is no need for further explaination undefined behaviour … | |
Re: Out of interest how many man hours have been spent by how many people rolling your own forum code? | |
Re: A segmentation fault is normally a memory error, access to an invalid or NULL address. Basically your compiler has crashed compiling your code. This does not necessarily mean there is any error in the code, there could be an bug in the compiler. Common fixes would be 1. Use a … | |
Re: At line 12 in quicksort.h you attempt to call `template <class Comparable> void quickSort(vector<Comparable> & arr, int left, int right)` before you have declared it, you define it at line 17. | |
Re: Lines 41 - 43 have the assignments the wrong way round, you are assigning the value of the class members to the initialisation parameters rather than the value of the initialisation parameters to the class variables e.g. `base = i;` | |
Re: 2) Steps a and b can be combined into a single click by clicking the last post time rather than the thread title which takes you striaght to the last post. Of course that doesn't really help that much in a thread with lots of posts where you have to … | |
Re: Your post links are not working for me and a quick scan of the code shows no obvious problem (not to me again at least) | |
Re: uset getline to get you file a line at a time as a string and then vector::push_back to add it to the vector. The will be a little inefficiency as the vector reallocates memory as it grows but for 161 entries this is unlikely to be a big issue. | |
Re: > On entering 1111 as the input number I should get 17 I think you mean 15? Your error is in the loop at lines 26 - 29. For a 4 digit binary number the loop at lines 18 - 24 will c=increment i to 5, the loop in lines … | |
Re: A bit of a sledgehammer approach but try calling InvalidateRect on you controls as you paint your window e.g. `InvalidateRect(License, NULL, FALSE);` | |
Re: The CMUcam2 seems to be explained at http://www.cmucam.org/projects/cmucam2/wiki where a data sheet with serial commands is available. | |
Re: [code] char Post_Request[998576];//998576 char Response[8576]; //2018 [/code] I don't believe that putting over 1 million bytes onto the stack is a good idea. generally speaking best practice is to keep the data on the stack relatively small. The method you are using to create your request with all those sprintfs … | |
Re: temp provides temporary space in which to perform the sort and should be the same size as the original array. While doing the sort the `merge` function uses the temp array to store the sorted list until is has complete the merge operation when it copies the sorted list back … | |
Re: Look at the way operator++ is defined in your code at line 8; it has no class name before the method name. It is not a member of the class point but rather just a function, the only difference being it has been declared as a friend of point so … | |
Re: Does the program crash if you select option 5 without selecting any other option? The code you have posted does not contain any obvious errors which means the error is else where. This is not entirely unusual, if some sort of undefined behaviour has been invoked it would be quite … | |
Re: Conventional wisdom seems to be that trying to read data from a file (or the console) directly as formated data leads to issues detecting end of file/ bad data. You should read the file line by line and then for each line process it into the data you are expecting … | |
Re: What would be really nice is if you could duplicate the "Watched Articles" link from the main menu bar somewhere in the "Recently Updated Articles" Bar back that way all the links I regularly use would be in a single place (at the bottom) rather than me needing to drag … | |
Re: When you called strtok at line 3 it replaced the ':' in line with a '\0' (because that is how it works). That reduces the string in `line` to "end" which does not contain ".word" and leaves tptr pointing at line. If you called strtok a second time then tptr … | |
Re: `sem_wait` blocks execution for potentially an infinite amount of time if the semaphore value is already 0 in order to lock the semaphore. It only returns -1 if there is an error, including a signal, during the wait. So "Blocked in Parent" and "Blocked in Child" will never be output. … | |
Re: Read each name into a string and assign to a vector of strings. Get the size of the vector and create a random number in the range 0 - (size-1). Record it. Repeat 4 more times throwing away any duplicates of entries already selected. Output the names corresponding to the … | |
Re: In the block of your if statement simple check the last character received (or all characters received may be) to see if it is an '!' and if so set a flag that causes the while loop to finish. iByteCount will only be 0 when the connection is closed so … | |
Re: Don't declare lots of individual vectors in Company declare a container of vectors, for example a vector of vectors: vector<vector<Employee*> > Location; // Each location has a position a map of vectors: map<int, vector<Employee*> > Location; // Each location has an id number alternative map of vectors: map<string, vector<Employee*> > … | |
Re: In C arrays can't be passed as arguments (or return values directly either) you can only pass pointers. Additionally C does not have 2 (or multi) dimension arrays when you declare `int a[10][10]` you are not declaring a 2 dimensional array but rather an array of arrays (a subtle but … | |
Re: The first line the order of the or'd conditions suggest that you check the data before validating the indexes you use to access the data. You need to validate the indexes first otherwise you could use out of range values. Again in the loop you calulate xn and yn and … |
The End.