1,494 Posted Topics
Re: 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. | |
Re: [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 … | |
Re: 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(). | |
Re: Could you indicate which line is 89. | |
Re: 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(). | |
Re: 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 … | |
Re: 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 … | |
![]() | Re: Try this one. [url]http://www.gtk.org/[/url] Here's the official tutorial [url]http://library.gnome.org/devel/gtk-tutorial/stable/[/url] |
| |
Re: 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(). | |
Re: Try replacing the problems line with this. [code] (*ptrL)->ptrNext = ptrInput; [/code] | |
Re: 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 | |
Re: 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 … | |
Re: [QUOTE=vineeshvs;1492434]tried that also. still error persists[/QUOTE] Why are you free'ing y and then returning it? | |
| |
Re: 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. … | |
Re: 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. | |
Re: Are you using a C compiler or C++. Your error message indicates a .cpp file? | |
Re: Could you post the code you have so far, so we can see exactly where your having problems? | |
Re: You posted code that doesn't contain a loop. | |
Re: Yes a code snippet would be helpful, lets start by seeing yours. | |
Re: 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] | |
Re: Line 6 is wrong, it should be [code] n = write(newsock_filedesc,buffer, 256) ; [/code] | |
Re: You'll have to change the memory attributes of the array to read and execute and then point the instruction pointer at it. | |
| |
Re: First question, what do you hope to gain by casting this? [code] if((int) total >= 90 && total <= 100) [/code] | |
Re: 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) << … | |
Re: 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. | |
Re: 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. | |
Re: When you need dynamic memory, trees, lists, passing large objects to functions. | |
Re: Are you sure this is C? I ask because you have a type string. | |
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 | |
Re: 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. | |
Re: Inclusion guards are a good example of usage. [url]http://en.wikipedia.org/wiki/Include_guard[/url] | |
Re: 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] | |
Re: Yes you need the libraries statically compiled or to be present on the machine. | |
Re: Try this and you'll display the first element in imgSet. [code] printf("%c", imgSet[0] ); [/code] | |
Re: [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] | |
Re: Your not posting enough information to diagnose your problem. | |
Re: 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 … | |
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 … ![]() | |
Re: 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 … | |
Re: 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 … | |
Re: 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]; … | |
Re: 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 … | |
Re: Why don't you write a program and see for yourself? |
The End.