1,494 Posted Topics
| |
Re: Posting every query that pops into your head is a misuse of this forum. | |
Re: You don't need to loop through the nodes in your overload << operator....Just print the current one and then point to the next node to print. | |
Re: This has so many unanswered questions.... How does the listening part of the server know that no more clients are pending without waiting? You mentioned shared memory segments at first then you say memory segment, which is it? Does the listening server create one memory segment for all the clients? … | |
Re: Number one, what is campus? Is it a c-string pointer or a character..Your comparing it it to a c-string pointer and them assigning a character to it. So what is campus? | |
Re: Well the first thing I would get working is a function that finds a c-string in a c-string. Once that's working then you can work on removing the characters. A side note - Are trying to accomplish this without the string library? | |
Re: [QUOTE=skiabox;1374228]I made the classic mistake of == instead of =. Sorry!! :([/QUOTE] Happens to all of us. Thank-you for posting that you found the solution. | |
Re: I'm really confused at how your using this static variable. Is it a local variable within a function? Maybe if you gave us an example of how you intend to use it..i.e. Post the code that's supposed to use the static variable. | |
Re: Well I always use fstream in my includes for file I/O. | |
Re: The first one doesn't assign or allocate any memory for the pointer to point to. | |
Re: Represented [code] #include <stdio.h> int main() { int mya[3][3][4]; return 0; } [/code] Which is the same(memory-wise) as a single dimension array [code] #include <stdio.h> int main() { int mya[36]; return 0; } [/code] | |
Re: Its probably because getchar() is leaving a newline character in the buffer. After your for statement put a fgetc(stdin). [code] for(i = 0; i < n; ++i) sir[i] = getchar(); fgetc(stdin); [/code] Daniweb has a great sticky on numerous problems and solution when dealing with input buffers. | |
Re: Here's a simple way to pass an array. [code] #include <iostream> void myfunc(int * x) { for (int i = 0; i < 7; ++i) std::cout << x[i] << std::endl; } int main() { int mya[] = {1, 2, 3, 4, 5, 6, 7}; myfunc(mya); return 0; } [/code] | |
Re: Line 88 [code] # printf("\n---------------------------… [/code] Is incorrect. Also, your prompting for 5 strings but I only see one place that you store the values char str[100]; | |
Re: If you want a function to square a double then try [code] double mysquare(double x) { return x * x; } [/code] | |
Re: Try compiling like this g++ filename.cpp -Wall -ansi -pedantic -o filename It will point to some very suspicious areas in your code. 21: warning: null argument where non-null required (argument 2) 21: warning: null argument where non-null required (argument 2) 18: warning: ‘stri’ is used uninitialized in this function The … | |
![]() | Re: Your probably missing a semi-colon in the other file. |
Re: I think the easiest way is, create another string and copy the original(minus the spaces) into it and then assign the temp to the original. | |
Re: Not sure what you mean by this line - "remove a consecutive occurrence of white space character". Do you mean remove all the spaces in a line of text? Because if that's your intent then try looking up the "C squeeze algorithm". | |
| |
Re: I have many annoying problems with this program...or my compiler has [code] testit.cpp: In member function ‘void Adressbok::search()’: testit.cpp:68: error: ‘readfile’ was not declared in this scope testit.cpp:68: error: ‘line’ was not declared in this scope testit.cpp:72: error: cannot convert ‘std::ofstream’ to ‘char**’ for argument ‘1’ to ‘__ssize_t getline(char**, size_t*, … | |
Re: Because the server is accepting the character(from the client) and then incrementing it and then sending it back to the client... Check lines 11 - 13 in the server program(the second part). | |
Re: By elements on the stack, do you mean arguments passed to the program at start up or do you mean displaying everything that's on the stack for the user program? | |
Re: Well first I would get the working functionality out of the way....I would create a function that displays your array. [code] #include <stdio.h> #define SIZE 10 void myfunc(int *x) { int i; int j; printf( "%s%13s%17s\n", "Element", "Value", "Histogram" ); for ( i = 0; i < SIZE; i++) { … | |
Re: Number of questions. The first one. Your variable char val[32]; Is it delimited with a '\0'? | |
Re: Look closely at your if statement if (k - 1 < 0 || j - 1 < 0); You have a semi-colon where it shouldn't be. | |
Re: Generally speaking when you use threads to modify/read global data, you use some form of lock to assure that the data isolated to the modifying/reading thread. | |
Re: Not sure what the problem is but you should never have this in a header file using namespace std; Also this line in your makefile Node.o: Node.cpp Node.h Why Node.h? Its already in the includes right? | |
Re: Your incrementing your pointer (ch) as you populate your array and then you increment it it again to display the array and then you finally free your pointer...how does this not crash? When you create you array on the heap save the initial pointer value like so: [code] char* ch … | |
Re: Your code should be executed or called within main..Example [code] int main() { if (some_condition) { } else if(some_other_condition) { } return 0 } [/code] You have a whole lot of code that isn't contained within main or any callable function. [code] #include <iostream> bool myfunc(const char *s)//function - myfunc … | |
Re: Olá It might help if we knew what Camiao **vecCamiao[]; Was... | |
Re: I would investigate the functionality bundled up in the string library...especially functions like strstr(). | |
Re: I just tried your code on a AMD/64 [code] #include <stdio.h> unsigned char data[3] = {0x3f,0x20,0xf2}; int main() { int j = 0; for(j=0;j<3;j++) printf("0x%x\n",data[j]); return 0; } [/code] And it produced output 0x3f 0x20 0xf2 | |
Re: Try fgets, this is from my Linux manpages(help files) char *fgets(char *s, int size, FILE *stream); gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. No check for buffer overrun is performed (see BUGS … | |
Re: You can't send pointers through a socket connection. Pointer addresses are only valid within its own address space. | |
Re: Well I would blah, blah blah. Please post code that is remotely correct or at least post code where the error is obvious or post an explanation of the problem... Posting something, something, blah, blah, blah makes us wonder - are you a spam bot? | |
Re: I really have to ask, what run time error is expected? All kidding aside take a look at the line I added. This forum had a real good sticky on problems and remedies when dealing with input buffers...I would look it up.. A few notes on sytle comments in standard … | |
Re: Those #define true 1 and #define false 0 are just preprocessor macros which will find and replace all true and false and replace them with 1 and 0 respectively. | |
Re: Well the first function takes a value and squares it with pow() and then passing the answer 4 to the second function which cubes it 4^3 = 64. | |
Re: Ancient D. is correct. Try running this program, noticing the output when you type path and filename. [code] #include <iostream> #include <string> int main() { std::string mystring; std::cout << "Enter path and filename->"; std::cin >> mystring; for (int i = 0; i < mystring.size(); ++i) std::cout << mystring[i] << " … | |
Re: This brings up one question. Where is the server getting the responds message? Is it from some canned messages that it reads down into? | |
Re: Please note that the label 'numbers' is a pointer to the first element in the array numbers[]. So we can write your function call like below: [code] #include <stdio.h> #define ARR_SIZE 7 int countEven (int* numbers) { int i = 0; for (; i < ARR_SIZE; ++i) fprintf(stdout, "ans->%d\n", *(numbers … | |
Re: I looked at your header file and you need to add std:: to string so that it reads std::string Remember your not using namespace std here because its a header file. | |
Re: Maybe I'm looking at this all wrong but won't you just copy the multimap to a map container of the same type? Ooops didn't read the entire post...please ignore. | |
Re: [QUOTE=Violet_82;1366294]Hi guys, quick question. Does the structure [CODE] try { } catch { exit(0); } [/CODE] require the preprocessor directive [CODE]#include<cstdlib>[/CODE] to be declared at the beginning of the program? The thing is if I don't declare it the visual c++ compiler works fine but if I try in Unix … | |
Re: Here's a good starting point. [code] #include <iostream> #include <vector> #include <algorithm> int main() { return 0; } [/code] | |
Re: First thing....Your function call "listPrimeExperiment()" where does it save/pass the address of the linkedlist? What I see is two local variables that don't pass back the addresses of the the linked list....So how can you access these unknown values? | |
Re: Why? Memory exhaustion is a very real possibility in a system with finite resources. | |
Re: Shouldn't you be prompting, for the numbers, inside the for loop? |
The End.