1,494 Posted Topics

Member Avatar for Sohelp
Member Avatar for Sohelp
Member Avatar for gerard4143
0
47
Member Avatar for Tecnicrow

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.

Member Avatar for Tecnicrow
0
601
Member Avatar for SpyrosMet

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

Member Avatar for SpyrosMet
0
201
Member Avatar for gahhon

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?

Member Avatar for gahhon
0
150
Member Avatar for Teelnaw

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?

Member Avatar for abhimanipal
0
210
Member Avatar for skiabox

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

Member Avatar for WaltP
0
152
Member Avatar for DerLars

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.

Member Avatar for gerard4143
0
142
Member Avatar for Violet_82
Member Avatar for Violet_82
0
198
Member Avatar for ybsolar
Member Avatar for gerard4143
0
135
Member Avatar for suma k

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]

Member Avatar for gerard4143
0
55
Member Avatar for creeps

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.

Member Avatar for creeps
0
103
Member Avatar for brycematheson

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]

Member Avatar for arkoenig
0
97
Member Avatar for atramposch

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

Member Avatar for gerard4143
0
149
Member Avatar for Shift-Stop

If you want a function to square a double then try [code] double mysquare(double x) { return x * x; } [/code]

Member Avatar for Shift-Stop
0
86
Member Avatar for rAshter

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 …

Member Avatar for gerard4143
0
118
Member Avatar for getack
Member Avatar for cbsinc

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.

Member Avatar for cbsinc
0
120
Member Avatar for nathanurag

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

Member Avatar for vinitmittal2008
0
173
Member Avatar for Tellalca
Member Avatar for meazza

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*, …

Member Avatar for meazza
0
292
Member Avatar for onus

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

Member Avatar for onus
0
153
Member Avatar for TheFeedingHand

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?

Member Avatar for mg120
0
180
Member Avatar for Chocolatemoon

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

Member Avatar for gerard4143
0
90
Member Avatar for ricardo.crudo

Number of questions. The first one. Your variable char val[32]; Is it delimited with a '\0'?

Member Avatar for Ancient Dragon
0
175
Member Avatar for hag++

Look closely at your if statement if (k - 1 < 0 || j - 1 < 0); You have a semi-colon where it shouldn't be.

Member Avatar for hag++
0
362
Member Avatar for fpsasm

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.

Member Avatar for gerard4143
0
103
Member Avatar for morgon

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?

Member Avatar for gerard4143
0
113
Member Avatar for Nathaniel10

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 …

Member Avatar for Nathaniel10
0
125
Member Avatar for jalenamichelle

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 …

Member Avatar for WaltP
0
98
Member Avatar for fantasma
Member Avatar for fantasma
0
122
Member Avatar for stud02

I would investigate the functionality bundled up in the string library...especially functions like strstr().

Member Avatar for WaltP
0
133
Member Avatar for karpe

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

Member Avatar for karpe
0
186
Member Avatar for heidik
Member Avatar for bufospro

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 …

Member Avatar for bufospro
0
185
Member Avatar for samp4ever

You can't send pointers through a socket connection. Pointer addresses are only valid within its own address space.

Member Avatar for samp4ever
0
700
Member Avatar for Unidennn

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?

Member Avatar for vijaykrishnabor
0
81
Member Avatar for digitaldan

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 …

Member Avatar for gerard4143
0
109
Member Avatar for techie1991

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.

Member Avatar for techie1991
0
229
Member Avatar for lauruskamj

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.

Member Avatar for lauruskamj
0
108
Member Avatar for Jsplinter

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] << " …

Member Avatar for Jsplinter
0
280
Member Avatar for ChainedHollow

This brings up one question. Where is the server getting the responds message? Is it from some canned messages that it reads down into?

Member Avatar for ChainedHollow
0
166
Member Avatar for Pooch74

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 …

Member Avatar for Pooch74
0
99
Member Avatar for losh177

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.

Member Avatar for losh177
0
183
Member Avatar for heidik

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.

Member Avatar for heidik
0
847
Member Avatar for Violet_82

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

Member Avatar for thelamb
0
164
Member Avatar for mchin131

Here's a good starting point. [code] #include <iostream> #include <vector> #include <algorithm> int main() { return 0; } [/code]

Member Avatar for gerard4143
0
67
Member Avatar for Knome

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?

Member Avatar for Martin B
0
4K
Member Avatar for Nathaniel10

Why? Memory exhaustion is a very real possibility in a system with finite resources.

Member Avatar for Nathaniel10
0
1K
Member Avatar for cortez716

The End.