1,494 Posted Topics

Member Avatar for nimaid
Member Avatar for emko
Member Avatar for emko
0
153
Member Avatar for bmos31

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?

Member Avatar for bmos31
0
205
Member Avatar for durpderp

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

Member Avatar for durpderp
0
109
Member Avatar for iwanttolearnc

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

Member Avatar for iwanttolearnc
0
114
Member Avatar for frogster

is the error on line 7 or 8? If its on 7 where is ConstantBuffer defined?

Member Avatar for StuXYZ
0
122
Member Avatar for danalovesc
Member Avatar for vbx_wx
Member Avatar for mike42intn
Member Avatar for Akill10
0
148
Member Avatar for |hex

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

Member Avatar for Akill10
0
85
Member Avatar for ftl25

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

Member Avatar for gerard4143
0
233
Member Avatar for praky

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 …

Member Avatar for brandonrunyon
0
428
Member Avatar for glenn612991

You might want to investigate arrays.. const size_t ARRAY_SIZE = 10; int MyIntArray[ARRAY_SIZE];

Member Avatar for Vllinator
0
2K
Member Avatar for gerard4143

Here's the newest 64 bit Flash Player from Adobe Labs....Way to go Adobe... [url]http://labs.adobe.com/downloads/flashplayer10.html[/url]

0
68
Member Avatar for myk45

This would be easier if you used strtol() to handle all the conversions.

Member Avatar for myk45
0
80
Member Avatar for gudads
Member Avatar for chromos
Member Avatar for fire_
Member Avatar for coffeewithcream

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

Member Avatar for mrnutty
0
3K
Member Avatar for eduard77

You don't really have to compute the number of numbers... [code] while (lower <= higher) { //do something ++lower; } [/code]

Member Avatar for eduard77
0
85
Member Avatar for gerard4143

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 …

Member Avatar for gerard4143
0
2K
Member Avatar for qwrobins
Member Avatar for tennis

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]

Member Avatar for gerard4143
0
136
Member Avatar for embooglement
Member Avatar for mrnutty
0
137
Member Avatar for bnickerson

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]

Member Avatar for nezachem
0
369
Member Avatar for JayNak
Member Avatar for gerard4143
0
60
Member Avatar for rahul8590

Try including stdlib.h Also, you may want to put this at the end of the main function - return 0;

Member Avatar for rahul8590
0
254
Member Avatar for Sinaru

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

Member Avatar for manojwali
0
592
Member Avatar for illuminatus89

Depends...Where are you declaring this const variable? Is it local, on the read/write stack?

Member Avatar for manojwali
0
104
Member Avatar for gerard4143

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

Member Avatar for DAlexNagy
0
232
Member Avatar for darkroad
Member Avatar for moonw3ll

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 …

Member Avatar for gerard4143
0
84
Member Avatar for D33wakar
Member Avatar for gerard4143
0
110
Member Avatar for fedya

[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

Member Avatar for uday jha
0
611
Member Avatar for gerard4143

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 …

Member Avatar for gerard4143
0
2K
Member Avatar for Rajkamal2013
Member Avatar for aminit

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?

Member Avatar for abhimanipal
0
77
Member Avatar for WAhamed

Well me let introduce you to the C++ section...Its here [url]http://www.daniweb.com/forums/forum8.html[/url]

Member Avatar for gerard4143
0
96
Member Avatar for cwarn23
Member Avatar for tesuji
0
381
Member Avatar for Anil2447
Member Avatar for itsbrad212

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

Member Avatar for itsbrad212
0
150
Member Avatar for XtremeCold

Huh? Is this supposed to make sense? Also, why are you using caps for your function? Is it a macro?

Member Avatar for XtremeCold
0
233
Member Avatar for creeps

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.

Member Avatar for [Alpha]-0mega-
0
200
Member Avatar for jeevsmyd

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

Member Avatar for gerard4143
0
142
Member Avatar for farahlyna

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

Member Avatar for gerard4143
0
126
Member Avatar for gallantlex
Member Avatar for gahhon

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

Member Avatar for gerard4143
0
235
Member Avatar for ftl25

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]

Member Avatar for gerard4143
0
2K
Member Avatar for edbarker
Member Avatar for daredevil786

Try substituting a memory value for x and working out the values...It works out to 4.

Member Avatar for pheininger
0
1K

The End.