1,494 Posted Topics
Re: Quick question, does it have to be a vector? Could it be a map? | |
Re: You have a memory leak in your = operator. You should first delete your member pointer before you create the new one. Plus you have numerous errors in your example like: [code] SomeClass(int size) {myMember = new OtherClass(thingSize);}; [/code] you have size but use thingSize? | |
Re: When you assign them memory or you may point then to an existing object which should already be initialized. Your example 'class foo' returns len which does not exist.... | |
Re: [QUOTE=iwanttolearnc;1332907]what my code does is it waits for the user to type in "led" and performs the blink function. what i am trying to do is introduce the letter 'p' as a command to stop the blinking. what happens is that blink is only executed once. [CODE]if (!(strcmp(userinput, led))){ //condition … | |
Re: is the error on line 7 or 8? If its on 7 where is ConstantBuffer defined? | |
Re: Try using iterators. | |
Re: Your incrementing copy then deleting it....How does this not crash? | |
Re: On lines 11 and 12...Do you even have a valid constructor for these? | |
Re: [QUOTE=|hex;1335941]i see how i missed that. i fixed that, but this statement: [code=cplusplus] else if (command != "function1" || "function2") { cout << "Invalid Entry\n"; cout << "Please your correct terms\n"; } [/code] keeps appearing. it always prints out, regeardless of putting y or Y.[/QUOTE] Its the same problem as … | |
Re: I'm not sure what you mean by a 'hex string'...Do you meant something like char hex_string[] = "0xffddee99"; [code] #include <stdio.h> #include <stdlib.h> #include <string.h> #define ARR_SIZE 6 int main(int argc, char**argv) { char hex1[10] = "0x"; char hex2[10] = "0x"; char ch[ARR_SIZE]; fputs("enter some hex->", stdout); fgets(ch, ARR_SIZE, stdin); … | |
Re: The results are the same -- a character is read -- but comparing the two is a little hard since your comparing two different programing paradigms...I guess if you strip away the syntax and look at the low level results of the code...then yes the code is equivalent since both … | |
Re: You might want to investigate arrays.. const size_t ARRAY_SIZE = 10; int MyIntArray[ARRAY_SIZE]; | |
Here's the newest 64 bit Flash Player from Adobe Labs....Way to go Adobe... [url]http://labs.adobe.com/downloads/flashplayer10.html[/url] | |
Re: This would be easier if you used strtol() to handle all the conversions. | |
| |
Re: other program's edit Not sure what you mean by this... | |
Re: The only thing you have to worry about is displaying the values...Try something like below std::cout<<std::hex<<1234<<std::endl; When you input the values make sure you use this format 0xXXX again see below 0x4d2 | |
Re: You don't really have to compute the number of numbers... [code] while (lower <= higher) { //do something ++lower; } [/code] | |
Could someone please verify. Is it proper to have pointers to containers(vectors in this example) where you allocate memory for them and then free them. I googled and found a posting that stated its considered poor coding style to do this...I doesn't seem like it should be poor programming style … | |
| |
Re: You haven't allocated any memory for your pointers [code] node* buildonetwothree() { node* head=NULL; node* second=NULL; node* third=NULL; head->data=1; head->next=second; second->data=2; second->next=third; third->data=3; third->next=NULL; return head; } [/code] | |
![]() | Re: Well if the string class is C++ then I would adopt its convention.. |
Re: Number one...are you checking to see if the file opened correctly? If so then try: [code] #define MAXLINE 4096 char recvline[MAXLINE]; int connfd; FILE *fd; while ((write(connfd, recvline, fread(recvline, 1, MAXLINE, fd))) > 0) {} [/code] | |
Re: Dumb reply...Why don't you run the code and see for yourself? | |
Re: Try including stdlib.h Also, you may want to put this at the end of the main function - return 0; | |
![]() | Re: I tried your code and got this Aborted [linux@localhost]$ echo $? 134 [linux@localhost]$ Note: I know that Ubuntu sets up its compiler slightly different than my Linux distro... |
Re: Depends...Where are you declaring this const variable? Is it local, on the read/write stack? | |
Hi, I'm looking for a book on C++...now before you flame me I did read the sticky "Read Me:C++ Books" and found the list interesting but for me uninformative...Why? I'm not really sure what C++ level I'm at currently. Let me elaborate...Here's my experience with the C family of languages.. … | |
Re: Here's what the man pages have to say: int atoi(const char *nptr); DESCRIPTION The atoi() function converts the initial portion of the string pointed to by nptr to int. The behavior is the same as strtol(nptr, (char **) NULL, 10); except that atoi() does not detect errors. You really should … | |
Re: [QUOTE=fedya;1063377]Hello, Can someone explain me what does this mean? "40[^\"], %*c" Thanks[/QUOTE] Could we see more of the program, so we can see it in context | |
Please check the line(s) of code after the comments '//this is the line of code in question... '. I want to know if this is the proper way to use the std::ostream operator<< in multi-inheritance? Basically I want the derived object(dog) to call the base object's std::ostream operators without hard-coding … | |
Re: Then I guess you should start programming right away... | |
Re: Let's see what you have so far... Question - Are you separating an integer into its separate digits or are you just putting spaces between something that's read from stdin? | |
Re: Well me let introduce you to the C++ section...Its here [url]http://www.daniweb.com/forums/forum8.html[/url] | |
Re: try here: [url]http://www.sqlite.org/cvstrac/wiki?p=SimpleCode[/url] | |
Re: Maybe you should try running the code and see what happens | |
Re: I would read line by line and check the first seven characters for a match..Try the function int strncmp(const char *s1, const char *s2, size_t n); | |
Re: Huh? Is this supposed to make sense? Also, why are you using caps for your function? Is it a macro? | |
Re: The braces(curly brackets) are there to define blocks of code and to help make your code readable...In some situations the coder can choose which he/she prefers but you should err on the side of readability. | |
Re: [QUOTE=jeevsmyd;1308395]I have been advised by many people that it is better to use integer return type for main function instead of void ! I actually dont understand what return 0 means .. main returns 0 value to program ! What does that mean ?! Could you please help me understand … | |
Re: [QUOTE=Adak;1307102]I never give people the address to my house. I always give them a *copy* of the address to my house. They always find my house, with no problem. ;) When you post code, use [CODE] tags around your code - always.[/QUOTE] You give them a copy of your address? … | |
Re: This is C++, please post in the correct section. | |
Re: Here's my two cents...I used the existing variable to reverse the characters. [code] #include <stdio.h> #include <stdlib.h> #include <string.h> char* reverseit(char* str, unsigned long size) { unsigned long i = 0; unsigned char c; for (i = 0; i < (size / 2); ++i) { c = str[(size - 1)- … | |
Re: Try something like [code] #include <stdio.h> typedef void (*myfunction)(void); void TSL1_ReadMemory32() { fputs("called!\n", stdout); } struct { myfunction thefunct; const char* functionName; }lookUpTable[] = { {TSL1_ReadMemory32, "ReadMemory32"}, {NULL, NULL} }; int main() { lookUpTable[0].thefunct(); return 0; } [/code] | |
Re: How is MOLNUMBER defined? | |
Re: Try substituting a memory value for x and working out the values...It works out to 4. |
The End.