- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 195
- Posts with Upvotes
- 167
- Upvoting Members
- 99
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Geeky programmer looking for the meaning of life, which so far seems to have very little to do with software
- Interests
- I have a daughter and therefore I have no time for interests...Oh ok RPG (the proper table top variety)
- PC Specs
- Home: Core 2 Duo Desktop Triple Booting Ubuntu/Vista/XP Work: Core 2 Duo Laptop WinXP and Core 2 Workstation…
556 Posted Topics
Re: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Rich Cook | |
Re: Seems we tend to get most irrate at the things we know and therefore stand out most to us as being wrong. A friend of mine who had been a train driver used to get excptionally irrate at how TV/movie trains react to things on the line vis-a-vis a) There … | |
Re: USART and SPI generally do different things and both tend to be 3 wire connections (because they require a ground). 2 wire connections tend to be used on a single PCB and don't require a ground because it would be extrememly unusual for a single PCB to have more than … | |
Re: I think you mean [b]L[/b]d returned 1 exit status. Do you really mean you tried to link the 2 c files and the h file or do you mean you compiled the c files and tried to link the resulting objects? The processor of building a program is [list] [*]Compile … | |
Re: Youve missed to top of your code 1. The easiest way to put a repeat into a game once it is already working is to move the whole game into a function, then add your loop that askes the user if they want to repeat in main and call the … | |
Re: Your method, BankAccount::NewBankAccount seems to be strangely named and you haven't included the code for it. I would more normally expect to see this sort of polymorpic behaviour implemented through a base class pointer BankAccount* acct = NULL; if (TypeToCreate == Normal) { acct = new BankAccount(name); } else if … | |
Re: I think that rather begs the question why would you want to create a package that either doesn't have a sender or doesn't have a receiver? Almost by definition a package should have both. Building on what @rubberman provided you can easily do this just by using the default constructor … | |
Re: "Why i can compile the program ?" this is a strange question, you can compile the program because you have a computer with a compiler on it ??? I suggest you try asking the question you actually want answered, are you getting compiler errors? Then post them. You have an … | |
Re: In both cases you have the following problems 1. `scanf("%d ", &shift);` the space after the %d is superfluous and could cause issues, remove it. 2. scanf will likely leave the '\n' (newline) after the number in the input stream which means in both cases the first character read by … ![]() | |
Re: You could simplify this by only putting the calculation of the monthly reward in the switch statement, i.e. double reward; /* printf/scanf statements to get membership and monthly purchase */ switch(membershiptype) { /* Cases to calculate the monthly reward and store in reward */ } /* printf statements to output … | |
Re: Remember that strtok (which frankly I would avoid using if possible) works by overwriting the delimiters with '\0', it is not deleting anything. It returns pointers into the original string. So when you call char *token; token = strtok("greetings pe()ple", "()"); it scans forward until it finds the '(', replaces … | |
Re: Firstly there is no need to use capitals that is generally consider rude as it is normally taken to equate to shouting. Posting the code will make easier for us to help. Posting a copy and past of the actual compiler output will make easier for us to help. I … | |
Re: Line 171 is redundent, it repeats line 168. The problem is line 169 temp->previous = new_node->previous; You are inserting the new node after temp so `temp->previous` should not change. `new_node` is ... well new, and so its previous pointer is set to NULL, you overwrite a value that does not … | |
Re: It rather depends on what the function is supposed to do, the function you have written assumes that the calling code has cast a bytearray to a void pointer to pass into the function (a somewhat pointless exercise in C++) liek this bytearry data; function((void*)&data); The bytearray create in func … | |
Re: There are all sorts of algorithms you can use, the problem with sorting a singley linked list is in removing an item from the centre of the list requires that you have a pointer to the the item before the item you want to remove (because it has a pointer … | |
Re: This is because fgets effective consumes the newline for you and fscanf doesn't I assume your file is R XXXX R DISNEY Remember at the end of each line is a newline character so the file can be presented by the character stream R XXXX\nR DISNEY\n This is an important … | |
Re: Looks like you are compiling very old legancy c code and like you are using a c compiler. C does not support function overloading so basically this error is saying you declared the function create_timer one way and now it has come accross another declaration that is different, has a … | |
Re: > If you exchange a block of m grams, you get three blocks of weight m/2, m/3 and m/4 grams each. Is the important part of this question because 1/2 + 1/3 + 1/4 = 13/12 or more than you started with. However, fractions are rounded down, so for example … | |
Re: At line 19 and 20 you are using the symbols `sys_nerr` and `sys_errlist` but this is the first time the compiler has seen them, you have not previously declared them anywhere hence they are "undeclared". You may have missed out a header file in which they are declared or you … | |
![]() | Re: Wrapper classes don't have to encapsulate another class, they can for instance encapsulte a legacy C interface or in your case a propriatory interface to some board. If you are trying to implement the same wrapper interface for 2 different boards it is worth using an interface class so that … |
Re: For the main to work you would have to change the output lines to cout << v1 <<" * "<< v2<< " = " << dot(v1, v2) << endl; All of your methods pass by value, Vector2D does not contain 2 much data, 2 doubles and a bool so about … | |
Re: Your while loop, lines 17 - 26 puts your list together in reverse order, so the first numbered entered appears at the end of the list and the last number entered at the beginning, because you keep adding to the front by altering `first`. That's OK it is the simplest … | |
Re: Your condition at line 45 `if(exp >= 10)` is wrong. Remeber that any number raise to the power of 0 is 1 but this is not what is embodied by your condition. I would also say you are missing a newline or 2 at line 43. Also storing exp as … | |
Re: At line 24 remove the `this` because that makes the current class (window/widget) the parent but line 36 tries to make the `_verticalLayout` the parent too and causes the warning since the parent is already set. | |
Re: Actually your code compiles fine, but it fails to link because in binTree.h you declare all the functions in the template class binTree but you don't define any of them. You need to write the imlementation of all those functions. | |
Re: libpcap is just the library that enables you to capture the network traffic, if the data you are capturing is not a protocol that WireShark already handles then your only options are to extract the data by hand (i.e. copy it off the screen or export to a text format … | |
Re: > Everything works fine if I use #include "Error_Handler.h" in the code. But #include "ErrorHandler.h" Typo in post or actual mistake? That said it would still help to see a few lines of code round the line producing the error. Also is this the first compiler error you get, if … | |
Re: **Line 54** template<class T > T display_array(T ItemType[10] , T const int arraySize) This is invalid. Remeber that the compiler will substitude the type T in the template into the code provided in order to instatiate the function for you. You can do this by hand and should get the … | |
Re: Subscriber::update, Subscriber::alter and Subscriber::noMessage all sound like they are doing the same thing and should be a single method. For the operation you want to perform you are missing an operation in Blackboard because there is no way to get the current message, you need a BlackBoard::getMessage method. Blackboard::notify and … | |
Re: Your are deleting memory that is in use and you are mixing heap and stack memory and trying to delete stack memory, all in `Sport::add`. You are using dynamic arrays of pointers so Line 194 - 201: Allocate a new array of pointers (`temp`) copy pointers from `array` to `temp` … | |
Re: Your code seems to work fine for me when I compiled it with MinGW after I commented out `#include "stdAfx.h"`. Note that "Visual Basic C++ 6.0" is not a thing did you mean Visual C++ 6 which is rather old? | |
Re: You will need code in your main function and you will need your other functions to return either a status or a sentinal value that can be tested in main to determin if the execution path needs to return to the start of the switch statement. | |
Re: This issue here is because MyTimerProc is static, and must be static to be passed to the C WIN API Function SetTimer it has no this pointer i.e. it does not require or have an instance of the object. It is in effect a normal function. However tmrprocedure is member … | |
Re: Line 11 `argv[i] = malloc(sizeof(temp));` or the modified form `argv[i] = malloc(sizeof(temp+1));` does not allocate enough memory. temp is a `char*` and has a fixed size 4 bytes (or maybe 8 depending on platform) so these 2 lines respectively allocate either 4 or 5 bytes of data. You then strcpy … | |
Re: My compiler does not support scanf_s (it's a Microsoft extension I think) but if I change your scanf_s to a scanf call it works as expected. So I looked up scanf_s in the Microsoft help and it said > Unlike scanf and wscanf, scanf_s and wscanf_s require the buffer size … | |
Re: > Yeah, you Europeans get the warm ocean current smashing on your coasts, while we get it on its way back from Greenland! Yes and it's that warm ocean current and the jet stream that means that currently a flood warning map for the UK looks like this  … | |
Re: I doubt it is compiling. Line 4: You have used assignment `=` when you meant to use compare `==`. `'36'` is not a valid character and it is not a number, if it compiled I expect it had the value 51 which is the ASCII value for the character 3. … | |
Re: You don't really need to re-write the code so it works with HTTP, HTTP uses TCP/IP sockets. HTTP is from the application layer of the protocol stack and TCP from the Transport layer and IP from the Internet layer; respectively layers 4,3 and 2 of the communication stack. That is … | |
Re: 1 from the section of my website that I call "Poetry (sort of)" The velociraptor of C++, was talking to a poet thus: the poet spoke, with some remorse, “It's hard to fit your name in verse.” The raptor to the poet said “No it's not 'cos my name's Fred. … | |
Re: I assume you have actually checked out the Twitter API? | |
Re: And it also looks like you are using pointers in the members of your structures when it looks like you did not intend to. struct the_struct { char *FirstName[20]; char *LastName[32]; int *Score[20]; }; FirstName and LastName are an arrays of pointers to char, did you in fact mean to … | |
Re: If for some reason you can't or don't want to implement `operator<`, for example it is already implemented to do something else you can always use the 2nd form of `std::sort` template <class RandomAccessIterator, class Compare> void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp); Which takes 3 parameters the 3rd … | |
Re: It is not at all clear what you are trying to achieve, however strings is an array of pointer to char (char \*) so `strings[i]` (or any other index) has type char \*, it is a pointer. I have no idea why you would then cast to integer as testing … | |
Re: That is because you only have 1 buffer, buff. At line 13 all you do is store a pointer to buff in the array token so all entries in token end up pointing an the same buffer, buff and when you print out your tokens they all contain the same … | |
Re: You have a few small problems but the one causing the error you are seeing is in Queue<ItemType>::Enqueue, if rear is NULL you set front but you do not set rear so the next time you enter this function rear is still NULL and you just overwrite front, incidentally causing … | |
Re: Your problem is between lines 23 - 31. You get 3 numbers from the user but you only use 1 variable so everytime you overwrite the previous number that the user input. Then at line 31 you push a single value, the last onbe entered, onto the stack. This comment … | |
Re: Problem 1: is at lines 45 and 48. You are passing pointers to objects that are on the stack but your class assumes that the objects are on the heap and treats the pointer accordingly. Calling delete on a pointer to a stack object is always going to fail. In … | |
Re: You're trying to declare the same object `obj` twice at lines 19 and 22. Your use of `Fileout` as a global object is extremely bad practice and the sort of thing that leads to unmanageable spagetti code. make `Fileout` local to main and then pass a reference to it to … | |
Re: The problem in deleteEntry is that you just free the memory for an entry without updating any of the pointers in the list at line 24 void deleteEntry () { struct Node *curr = Head; char name [15], decide; int Decide; printf("Last Name To Delete\n"); scanf("%s", &name); getchar (); while(curr … | |
Re: I've always said in C you should not cast the return value of malloc (or calloc). That is because if you leave out stdlib.h C will happily let you call the function without a predeclaration (although many C compilers produce warnings for that now but people then have to take … |
The End.