why not like this:

[CODE]#include

include

class A{
std::string s;
public:
A(){ s = "1234567"; }
char operator []( const int index ){ return s.at(index); }
};

int main (int argc, char const* argv[])
{
A a;
std::cout << a[0] << std::endl;
return 0;
}[/CODE]

I'm sorry

[CODE]
iter->first.first;
iter->first.second;[/CODE]

you need to type cast it:

[CODE]const int constPtr2=(const int)ptr2; [/CODE]

here you go:

[CODE]
iter->first->first;
iter->first->second;
[/CODE]

better have the send only once:

when it's almost DRY ;)

[CODE]//read file and send
if (myfile.is_open()) //if the file is open
{
ss << "HTTP/1.0 200 OK \r\n\r\n";
while (getline(myfile, line))
{
ss << line;
ss << "\n";
}
}
else{
ss << "HTTP/1.0 404 FILE NOT FOUND \r\n\r\n";
}

nbytes=send(newsockfd, ss.str().c_str(), ss.str().size(), 0);

if(nbytes < 0) {
    perror("send error");   
    exit(1);
}[/CODE]

Correct me if I'm wrong, but shouldn't you first accept incoming connection and this connection put into epoll? Epoll will tell when the socket is ready to read or write.

As far as i see, epoll_wait is to early...

After bind you should accept.

Does the function "setFirstName" take the parameter as reference?

and to make it more smooth

instread of:

[CODE]strcat(strfinal, "HTTP/1.0 200 OK \r\n\r\n");
if (myfile.is_open()) //if the file is open
{
while (! myfile.eof() ) //while the end of file is NOT reached
{
getline (myfile,line);
cout << line << endl;
strcat(strfinal, line);
}
}
send(newsockfd, strfinal, sizeof(strfinal), 0);[/CODE]

better:
[CODE]

include

[/CODE]

[CODE]
std::sstream ss;

ss << "HTTP/1.0 200 OK \r\n\r\n";

if (myfile.is_open()) //if the file is open
{
    while (getline (myfile,line) ) //while the end of file is NOT reached
    {
        cout << line << endl;
        ss << line;
    }
}  

send(newsockfd, ss.str().s_str(), ss.str().size(), 0);[/CODE]

line 36:
should to be: std::string line;

line 80:
strcat(strfinal, line.c_str() );

instread of:

[CODE]while (! myfile.eof() ) //while the end of file is NOT reached
{
getline (myfile,line);
cout << line << endl;
strcat(strfinal, line);
}[/CODE]

better:

[CODE]while (getline (myfile,line)) //while the end of file is NOT reached
{
cout << line << endl;
strcat(strfinal, line);
}[/CODE]

Hi!

I not sure that i got it, can you provide a example? I love examples!

Hi!

I would create a base class, from which the myTemplateClass will inherit.

like this:
[CODE]
class TemplateClassBase{};

templateclass myTemplateClass : TemplateClassBase{};[/CODE]
This should be a list:
[CODE]myTemplateClass templateClassPtrArray[10];[/CODE]
This is better:
[CODE]std::list<TemplateClassBase
> templateClassPtrArray;[/CODE]

[CODE]templateClassPtrArray.push_back( new myTemplateClass() );
templateClassPtrArray.push_back( new myTemplateClass() );
[/CODE]

Code is NOT tested, was written from scratch.

When you have no problem to save anything.

I hope i was clear :/

tried this?

[CODE]ifstream Data[/CODE]

It's the same.

[QUOTE=firstPerson;1064169]An even easier way :[URL="http://www.cplusplus.com/reference/iostream/istream/tellg/"]Link[/URL][/QUOTE]

yeah, but we dont want to count like \r\n ., etc..

I would put the whole parameter in a struct, when is more readable:

[CODE]vector& A, vector& B, vector& C, double x, double& p, double& px, double& pxx, int& degree[/CODE]

better:

[CODE]
struct SomeName{
vector A;
vector B;
vector C;
double x;
double p;
double px;
double pxx;
int degree;
}[/CODE]

the whole thing is confusing me.

[CODE]class A:
_a = 33

class B:
__b = 22

a = A()
b = B()

print a._a
print b.__b[/CODE]

Output:

[CODE]33
Traceback (most recent call last):
File "p.py", line 12, in
print b.b
AttributeError: B instance has no attribute '
b'[/CODE]

You welcome!

Well, maybe you should redesign your program? It looks odd.

did you try without "endl"?

I don't see that you use hashTable or hashfunction?

it can be done much easier: [url]http://clipboard.it/v/XUb/[/url]

one of your variabes, does not support the >> operator.

Which type are the variables:
lvl
xp
str
spd
acc
hp
inventory?

Your are in the right way.

Well, String is not string. You have to write it in lowercase.

[CODE]void toString();[/CODE]

should be:

[CODE]void toString(string &target);

void Employee::toString(string &target){
target = "Name: " + empName + " / Employee Number: " + empNum + " / Hire Date: " + hireDate;
}
[/CODE]

this works:

[CODE]CandyBar cb[3] = { {"Three Musketeers", .33, 200},
{"Hershey's", .45, 225},
{"Mars", .45, 2250} };[/CODE]

kind like this:

[CODE]CandyBar cb = {"Hershey's", .45, 225};[/CODE]

Only works at initialization.

Line 11. is already too late

Private attributes are always with "__" double underscore.

jlm699 commented: There's nothing unclear about this post. It states a fact. +3