1,494 Posted Topics

Member Avatar for moritz11

If your interested in the makings of C++ code the may I recommend a book by Stanley Lippman - Inside The C++ Object Model. Its a great read and addresses many your questions.

Member Avatar for Narue
-1
226
Member Avatar for moroccanplaya

[QUOTE=moroccanplaya;1510163]i cant seem to send my html file through a socket, when vere i connect to the server via web browser [url]http://localhost:7000[/url] it just freezes. and the server stops [CODE] open_ptr = open("/home/user/www/home.html",'r'); while((n = read(open_ptr,buffer,256)) > 0) { n = write( new_sock,buffer,256); } close(open_ptr); return 0; } [/CODE][/QUOTE] Are …

Member Avatar for moroccanplaya
0
101
Member Avatar for Mal-man

You can use the == operator to compare the elements of the character array which is what your doing in the above code. If you want to compare c-strings then you could use strcmp().

Member Avatar for darkdai
0
7K
Member Avatar for fsamu2001
Member Avatar for b56r1

It creates a dynamic shared library that can be loaded and unloaded when the program is running, meaning you don't have to compile/link them during the compile/link cycle. Try looking up the functions in the library dlfcn.h - dlopen(), dlclose() and dlsym().

Member Avatar for rubberman
0
134
Member Avatar for programing

I'm not sure what you mean by extract a value. Do you mean get the value? This gets the value of the nth element of array. [code] int value = array[n]; [/code] A note on style, search functions usually return the address of first element match. Your function returns the …

Member Avatar for programing
0
173
Member Avatar for slygoth

Line 33. [code] fprintf(ci,"Amount paid to date: %.2f\n",& info.apaid); [/code] Your passing the address of info.apaid to fprintf.. It should be. [code] fprintf(ci,"Amount paid to date: %.2f\n", info.apaid); [/code] Also your using fflush() incorrectly, you should never flush an input stream. If you want to flush all possible streams then …

Member Avatar for gerard4143
0
290
Member Avatar for hohoho89

Try this one. [url]http://www.gtk.org/[/url] Here's the official tutorial [url]http://library.gnome.org/devel/gtk-tutorial/stable/[/url]

Member Avatar for rubberman
0
176
Member Avatar for Gudger
Member Avatar for amari ♥

Could you please post code using the proper code tags and please format your code. As for problems, the main function should return an integer and why are you using the getch() function when the standard provides fgetc().

Member Avatar for gerard4143
0
117
Member Avatar for efronefron

Try replacing the problems line with this. [code] (*ptrL)->ptrNext = ptrInput; [/code]

Member Avatar for efronefron
0
189
Member Avatar for cse.avinash

You could do it this way in Linux. [code] #include <stdio.h> #define ARR_SIZE 200 int main() { char ch[ARR_SIZE]; fgets(ch, ARR_SIZE, stdin);/*read data1*/ fputs(ch, stdout);/*write data2*/ fgets(ch, ARR_SIZE, stdin); fputs(ch, stdout); fgets(ch, ARR_SIZE, stdin); fputs(ch, stdout); return 0; } [/code] Console line ./testfile < data1 > data2

Member Avatar for Adak
0
1K
Member Avatar for himgar

Here's a hint, I'll let you figure out the last loop. [code] #include <stdio.h> int main()/*main returns an int*/ { int i, j, k; for( i = 1; i <= 3; i++) { for( j = 1; j <= 3 - i; j++) printf(" "); for( k = 1; k …

Member Avatar for L7Sqr
0
87
Member Avatar for vineeshvs

[QUOTE=vineeshvs;1492434]tried that also. still error persists[/QUOTE] Why are you free'ing y and then returning it?

Member Avatar for vineeshvs
0
259
Member Avatar for lochnessmonster
Member Avatar for themask18

Read The C Programming Langauge by Brian Kernighan and Dennis Ritchie C Traps and Pitfalls by Andrew Koeing - Note I never read this particular book but have read others authored by Koeing and found the quality high. If really want to understand C, then learn how the machine works. …

Member Avatar for themask18
1
154
Member Avatar for NickJoe

The reason it fails for negative numbers is, your shifting the signed bit off. Try masking and saving the signed bit and then shift and then mask the signed bit back on.

Member Avatar for gerard4143
0
277
Member Avatar for servooo
Member Avatar for gerard4143
0
385
Member Avatar for localp
Member Avatar for gerard4143
0
94
Member Avatar for az_ez
Member Avatar for rohan_k
Member Avatar for n3red

The reason is failing to compile is this line of code. [code] lines = tolower(atoi(lines)); [/code] which should be [code] lines[index_value] = tolower(lines[index_value]); [/code]

Member Avatar for gerard4143
0
112
Member Avatar for az_ez
Member Avatar for moroccanplaya
Member Avatar for moroccanplaya
0
83
Member Avatar for nory22
Member Avatar for pseudorandom21

You'll have to change the memory attributes of the array to read and execute and then point the instruction pointer at it.

Member Avatar for gerard4143
0
3K
Member Avatar for AmerJamil
Member Avatar for efronefron
Member Avatar for efronefron
0
287
Member Avatar for geoffy0404

First question, what do you hope to gain by casting this? [code] if((int) total >= 90 && total <= 100) [/code]

Member Avatar for jephthah
0
141
Member Avatar for agarg12

You have a name collision with the standard library. [code] #include<iostream> template <typename T> inline const T& max (const T & w,const T & x) { return w > x ? w : x; } int main() { int a = 10, b = 343; std::cout << max(a, b) << …

Member Avatar for agarg12
0
134
Member Avatar for jayzee1989

Line 42 only gets the character entered, its still leaves the new-line character in the stream so when you loop line 42 scanf's the new-line character and then produces the menu again.

Member Avatar for jayzee1989
0
125
Member Avatar for ROTC89

Wow, you have functions that are +100 lines long... This would be a good time to consider using the inline qualifier and break these large functions into smaller, neater inline functions.

Member Avatar for ROTC89
0
111
Member Avatar for WildBamaBoy

When you need dynamic memory, trees, lists, passing large objects to functions.

Member Avatar for WildBamaBoy
0
172
Member Avatar for TimBob12
Member Avatar for Layosh
0
3K
Member Avatar for gerard4143

Hi, I'm looking for a good book on Qt 4 programming, I checked both chapters and amazon but couldn't locate a Qt book with favorable reviews and was wondering if the daniweb members knew of a good text...Thanks in advance. Gerard4143

Member Avatar for gerard4143
0
113
Member Avatar for jephthah

The only difference I can see is, if you use the second method you have to open and update the header.h file whenever you need a new libraries functionality..The first method, just add the include at the top of the file no updating a header file.

Member Avatar for Ancient Dragon
0
486
Member Avatar for ninjatalon

Inclusion guards are a good example of usage. [url]http://en.wikipedia.org/wiki/Include_guard[/url]

Member Avatar for Fbody
0
117
Member Avatar for geoffy0404

Right away I see a problem...What if you enter 90 or 100, how does your program handle that. You should be saying, A is a grade from 90 to 100. [code] if (total >= 90) [/code]

Member Avatar for mtatadotcom
0
98
Member Avatar for thekitoper

Yes you need the libraries statically compiled or to be present on the machine.

Member Avatar for gerard4143
0
94
Member Avatar for jayzee1989

Try this and you'll display the first element in imgSet. [code] printf("%c", imgSet[0] ); [/code]

Member Avatar for jayzee1989
0
110
Member Avatar for atticusr5
Member Avatar for atticusr5
0
111
Member Avatar for slygoth

[QUOTE=slygoth;1495395]Write a function that accepts a pointer to a string and a character and returns the number of times the character is found in the string. [/QUOTE] Your function prototype should be [code] int countletter(char *str, char c); [/code]

Member Avatar for slygoth
0
212
Member Avatar for ajcc103
Member Avatar for rjbrjb777

Yes, if you have a multi-core processor then its possible to run both programs at the same time but I'm uncertain of how you would get the operating system to coordinate or make sure that when one is running then run the other...A better solution would be one program that …

Member Avatar for WaltP
0
113
Member Avatar for gerard4143

I'm wondering what is the proper way to point at an overloaded function. Is it correct to cast the function to the proper type? [code] #include <iostream> int double_it(int x) { return x * 2; } int double_it(int x, int y) { return (x + y) * 2; } int …

Member Avatar for nileshgr
2
150
Member Avatar for mkab

I would say the entries in your Makefile are in the wrong order. This line [code] test: prog2.o gcc *.o -o test [/code] requires that [code] liste.c outils_liste.c constantes.c [/code] are built object files. They aren't built when you call them here....unless your make utility reads the entries in the …

Member Avatar for gerard4143
0
318
Member Avatar for bleedsgreen33

Try passing your structure by reference....Wow you called your structure std? Don't do that. [code] #include <iostream> #include <cstdlib> using namespace std; struct str/*don't call your structure std*/ { string name; int idNumber; string year; float gradepoint[8]; int hours[8]; float avg; }; void testFill(struct str & arg);/*pass by reference*/ void …

Member Avatar for bleedsgreen33
0
144
Member Avatar for andrew85

For this to work, you'll have to save the number of characters matched in each retrieval... Something like below. [code] #include <stdio.h> #include <stdlib.h> int main(int argc, char**argv) { int res = 0; int res2 = 0; char buf [] = "25+2;44+1;8-2."; char op1[20]; char op2[20]; char operazione[20]; char en[20]; …

Member Avatar for andrew85
0
155
Member Avatar for ram619

A few notes, this is C so main return an integer and you should define your array like below. [code] #include<stdio.h> int main() { int arr[5][5]={ {2,4,8,11,15},{6,8,5,8,7},{3,5,1,21,72},{28,95,62,8,2},{4,1,7,6,8}}; int i,j,val; val=arr[0][0]; for(i=0;i<5;i++) { for(j=0;j<5;j++) if(val<arr[i][j+1]) { val=arr[i][j+1]; } } printf("\n %d ",val); return 0; } [/code] This worked correctly on my …

Member Avatar for ram619
0
126
Member Avatar for lochnessmonster

The End.