556 Posted Topics

Member Avatar for nstruzik

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. …

Member Avatar for Ancient Dragon
0
222
Member Avatar for dot_binary

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 …

Member Avatar for Banfa
0
170
Member Avatar for myk45

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 …

Member Avatar for myk45
0
300
Member Avatar for capton

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 …

Member Avatar for capton
0
132
Member Avatar for I_m_rude

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 …

Member Avatar for Banfa
0
204
Member Avatar for Vish0203

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 …

Member Avatar for Vish0203
0
136
Member Avatar for MasterHacker110

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.

Member Avatar for MasterHacker110
0
130
Member Avatar for I_m_rude

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 …

Member Avatar for Perry31
0
116
Member Avatar for anuran

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 …

Member Avatar for Banfa
0
261
Member Avatar for newbie1234

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 …

Member Avatar for sepp2k
0
129
Member Avatar for Danja

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 …

Member Avatar for hkwhitten
0
1K
Member Avatar for SCass2010

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 …

Member Avatar for L7Sqr
0
2K
Member Avatar for anuragcoder

[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 …

Member Avatar for thunderox
0
11K
Member Avatar for n1csaf3

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).

Member Avatar for ravenous
0
156
Member Avatar for kandarpa

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.

Member Avatar for deceptikon
0
264
Member Avatar for etsko

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 …

Member Avatar for Oxiegen
0
426
Member Avatar for Dani

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 …

Member Avatar for Sahil89
0
843
Member Avatar for yoni0505

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 …

Member Avatar for yoni0505
0
1K
Member Avatar for cossay

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.

Member Avatar for Banfa
0
140
Member Avatar for sharath_137

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.

Member Avatar for Banfa
0
594
Member Avatar for Lucaci Andrew

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 …

Member Avatar for Lucaci Andrew
0
172
Member Avatar for bobanderson90

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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for native99

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 …

Member Avatar for Banfa
0
243
Member Avatar for luvrahul30

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. …

Member Avatar for luvrahul30
0
117
Member Avatar for NickPatton

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 …

Member Avatar for NickPatton
0
1K
Member Avatar for phorce
Member Avatar for Banfa
0
143
Member Avatar for freddyk

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 …

Member Avatar for rubberman
0
163
Member Avatar for jbennet

Out of interest how many man hours have been spent by how many people rolling your own forum code?

Member Avatar for Airshow
0
2K
Member Avatar for subith86

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 …

Member Avatar for mitrmkar
0
3K
Member Avatar for Kamina00

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.

Member Avatar for Kamina00
0
262
Member Avatar for grh1107

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;`

Member Avatar for Banfa
0
183
Member Avatar for WaltP

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 …

Member Avatar for Airshow
1
246
Member Avatar for jwill222

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)

Member Avatar for jwill222
0
275
Member Avatar for sarathsshanker

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.

Member Avatar for mrnutty
0
195
Member Avatar for abhishek_ag

> 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 …

Member Avatar for abhishek_ag
0
268
Member Avatar for triumphost

A bit of a sledgehammer approach but try calling InvalidateRect on you controls as you paint your window e.g. `InvalidateRect(License, NULL, FALSE);`

Member Avatar for Banfa
0
1K
Member Avatar for Gazzmonkey

The CMUcam2 seems to be explained at http://www.cmucam.org/projects/cmucam2/wiki where a data sheet with serial commands is available.

Member Avatar for Gazzmonkey
0
194
Member Avatar for Ricky65

[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 …

Member Avatar for bakri
0
1K
Member Avatar for TheWind147

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 …

Member Avatar for TheWind147
0
331
Member Avatar for FelineHazard

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 …

Member Avatar for FelineHazard
0
216
Member Avatar for while(!success)

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 …

Member Avatar for while(!success)
0
243
Member Avatar for dinners

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 …

Member Avatar for m4ster_r0shi
0
101
Member Avatar for C0ding

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 …

Member Avatar for Banfa
0
167
Member Avatar for hwoarang69

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 …

Member Avatar for Banfa
0
92
Member Avatar for Gaiety

`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. …

Member Avatar for Banfa
0
132
Member Avatar for arn2025

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 …

Member Avatar for Banfa
0
92
Member Avatar for ponnds

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 …

Member Avatar for Banfa
0
2K
Member Avatar for phummon

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*> > …

Member Avatar for phummon
0
212
Member Avatar for chirag_mittal

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 …

Member Avatar for chirag_mittal
0
434
Member Avatar for JamesGreen

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 …

Member Avatar for Banfa
0
164

The End.