1,494 Posted Topics

Member Avatar for kevintse

Because both strings, in foo and bar, are string literals they 'may' be stored in the text section(or some read only section) and therefore may be permanent to the process.

Member Avatar for kevintse
0
129
Member Avatar for Dexxta27
Member Avatar for jsav
Member Avatar for jsav
0
282
Member Avatar for MixedCoder

Wow..You really should download a tutorial on mysql. You haven't established a valid connection to your database, yet your preforming a query on it...Here's a brief example [code] #include <mysql/mysql.h> #include <stdio.h> int main(int argc, char **argv) { MYSQL *conn;/*connection*/ MYSQL_RES *res;/*result*/ MYSQL_ROW row;/*row*/ char server[] = "localhost"; char user[] …

Member Avatar for gerard4143
0
292
Member Avatar for shishh

If you look at the prototype of sprintf int sprintf(char *str, const char *format, ...); You'll note that the first argument is a char *str...your passing a character on line 78 sprintf(temp_out[i], "%d", cene[i]); temp_out[i] is a character. You might be able to get away with something like below where …

Member Avatar for gerard4143
0
590
Member Avatar for Joey_Brown

Your representation of your 2-dim array leaves a lot open for interpretation...Do you mean if you have a 2-dim array like below {a, b, c, d}{a, f, h, k} would have a final result {@, b, c, d}{@, f, h, k}

Member Avatar for Joey_Brown
0
125
Member Avatar for moroccanplaya

Could be you freed a pointer *and did not set it to NULL* and then tried to free it again..The message indicates the problem lies at address 0x089b8008 *** glibc detected *** ./tryp: double free or corruption (top): 0x089b8008 ***

Member Avatar for moroccanplaya
0
120
Member Avatar for Castiel1631

I quickly looked at your 'addMyString' function...Your adding the character before you check the capacity. Shouldn't it be the other way around?

Member Avatar for Castiel1631
0
2K
Member Avatar for azka

[QUOTE=azka;1047286]Hello, i have problem at address: 0x0040E0D6 mov eax,dword ptr [ecx] the solution would be to place an instruction to check if ecx is 0 and finishing this function, but how to do this? Thx![/QUOTE] I would investigate the compare opcode and jump equal, jump not equal opcodes Try this …

Member Avatar for azka
0
166
Member Avatar for hystaspes

Nope, no drawbacks. The this pointer is just a pointer to the data members of the object..If omitted in member functions its assumed. Should you use it? It really depends on your preference.

Member Avatar for hystaspes
0
124
Member Avatar for rafi1082

@Adak Why are you recommending [code] #define LONG 8 #define INT 4 #define SHORT 2 [/code] instead of the compile time sizeof operator?

Member Avatar for Adak
0
130
Member Avatar for iamthesgt

Shouldn't this 3 5 3.9 4.5 2.1 1.0 2.4 4.3 3.1 4.2 5.1 6.2 1.0 2.7 1.2 2.3 3.1 4.2 5.2 6.4 be 3 6 3.9 4.5 2.1 1.0 2.4 4.3 3.1 4.2 5.1 6.2 1.0 2.7 1.2 2.3 3.1 4.2 5.2 6.4

Member Avatar for iamthesgt
0
189
Member Avatar for majood

segmentation fault results from trying to read/write from/to an invalid address.. Here's what happens when fgets() encounters the end of file or an error...Quote from my man files "char *fgets(char *s, int size, FILE *stream); gets() and fgets() return s on success, and NULL on error or when end of …

Member Avatar for VernonDozier
0
1K
Member Avatar for sciprog1

Its been some time since I looked at pipes so I would go over this code with a fine tooth comb...You'll probably find places in the code that need improvement. [code] #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> enum PIPES {READ, WRITE}; int main(int argc, char**argv) { char ch[] …

Member Avatar for sciprog1
0
129
Member Avatar for moroccanplaya

You could try these two functions size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);

Member Avatar for moroccanplaya
0
113
Member Avatar for moroccanplaya
Member Avatar for tomtetlaw

Just set the pointer to NULL. void *vptr = (void*)NULL; You should get into a habit of initializing all pointers to NULL and all freed pointers to NULL.

Member Avatar for tomtetlaw
0
97
Member Avatar for skorm909
Member Avatar for alexchen

This requires a c string gets(me.age);//error not a short. Here's gets prototype char *gets(char *s); Also gets is a dangerous function that should never be used..Here's a short blurb on why. Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() …

Member Avatar for alexchen
0
136
Member Avatar for kousamir
Member Avatar for westony

Go to this link and read [url]http://library.gnome.org/devel/gtk-tutorial/stable/[/url]

Member Avatar for westony
0
102
Member Avatar for berwick53
Member Avatar for jeremy62

Try initializing these values [code] int sum = 0; int average = 0; int num = 0; int i = 0; [/code] also [code] scanf( "%d", &a[SIZE]); [/code]

Member Avatar for darkbreaker
0
155
Member Avatar for westony

You have i < (i + p)...unless p is negative(or becomes negative) you'll never exit you for loop.

Member Avatar for Shankye
0
108
Member Avatar for tech9x
Member Avatar for tech9x
0
145
Member Avatar for jvill
Member Avatar for jvill

Wow your instructor couldn't find the error..Try this function [code] long int power(int n,int p) { long int ans = n; int i = 1; for (; i < p; ++i) ans *= n; return ans; } [/code]

Member Avatar for jvill
0
144
Member Avatar for alainigban

Your if - line 58 [code] if (ans3 == 'e') cout << endl; [/code] probably should be [code] if (ans3 == 'e') { cout << endl; [/code]

Member Avatar for Fbody
0
249
Member Avatar for SVSU_Student

Won't this for read twice for each iteration [code] for(count = 0; count < SIZE && inputFile >> score[count]; count++); inputFile >> score[count]; [/code] Actually on second look what are you doing here? You have a for loop that reads from your file and then you have a read right …

Member Avatar for Fbody
0
165
Member Avatar for tomtetlaw
Member Avatar for tomtetlaw
0
83
Member Avatar for becka221

I would investigate the string library's function strcat() and functions like sprintf();

Member Avatar for vinitmittal2008
0
152
Member Avatar for tawes01
Member Avatar for tawes01
0
289
Member Avatar for baby_c

You have to create your array on the heap in this situation...Returning an address to an array on the stack won't work because the address is invalid as soon as the function returns..

Member Avatar for baby_c
0
148
Member Avatar for vbx_wx

Try [code] SocketSpace::TCPSocket* SocketSpace::ServerSocket::accept() [/code]

Member Avatar for vbx_wx
0
144
Member Avatar for onus

because your added extern extern int stack_counter; extern snode sroot; This informs the linker that both of these are defined elsewhere.

Member Avatar for GuitarComet
0
186
Member Avatar for jasleen12345

You have major problems in your code...I tried compiling it and set off many errors and warnings...Try starting with this shell. [code] #include <iostream> #include <cstring> class string { public: string():s(NULL), itssize(0) {} string(const char* const cstring); void displayit() const { std::cout << s << std::endl; } private: char *s; …

Member Avatar for wickedflo
0
132
Member Avatar for digitaldan
Member Avatar for digitaldan
0
193
Member Avatar for mpassaglia

Line 68, your setting myfile to NULL. It should be myfile == NULL I'm surprised your compiler didn't complain about that line. I corrected it and the program works now.

Member Avatar for mpassaglia
0
2K
Member Avatar for tvand7093
Member Avatar for mcodesmart

Not sure what bit running = 0; is and why you need to take the address and then dereference it...Won't it make more sense to just assign 0 or 1 to running?

Member Avatar for Ancient Dragon
0
124
Member Avatar for sahil1991

Your not allocating any memory for the member variable name. This would work better if you define name as a std::string.

Member Avatar for fmadsen
0
112
Member Avatar for onus

Here's an example of creating a packed structure using attribute [code] struct mystr { char ca; unsigned int i; }__attribute__((packed)) thestr; [/code]

Member Avatar for sree_ec
0
605
Member Avatar for onus

I know this is probably radical but why don't you write some code, like below, and try it yourself. [code] #include <stdio.h> #include <stdlib.h> struct mystr { unsigned int a; unsigned int b; unsigned int c; }thestr[3] = {{0,},}; int main(int argc, char**argv) { int i; for (i = 0; …

Member Avatar for onus
0
109
Member Avatar for yuri1969

Here's an example of using select() which can solve your problem [url]http://linux.die.net/man/2/select_tut[/url]

Member Avatar for yuri1969
0
5K
Member Avatar for lochnessmonster

This is an accepted practice...Don't use any form of using namespace_name; in a header file.

Member Avatar for mike_2000_17
0
311
Member Avatar for letaki

Its a warning so it may work...Try casting the offending variable int X=execvp ("compute",(char* const*)args);

Member Avatar for nezachem
0
1K
Member Avatar for CrazyDieter

I'm pretty sure it has to be like this: QApplication qApp(&argc, &argv); Ooops, got GTK+ mixed up with QT4.

Member Avatar for gerard4143
0
173
Member Avatar for bufospro

Sounds like your code doesn't have a main function...Could you post the code and the compile line.

Member Avatar for sree_ec
0
1K
Member Avatar for imyellowjacket

Its an error because you can't dereference a void pointer..rbuf is a void pointer. *rbuf= &svar; What exactly are you trying to a accomplish here? What is the purpose of the program?

Member Avatar for imyellowjacket
0
4K
Member Avatar for javac++

The End.