For some reason, append won't work on the strings...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class Protection{
public:
char* name;
string* filter;
int version;
ProtectionType ptype;
Protection(char* n, string f, ProtectionType p, int v)
{
name = n;
ptype = p;
version = v;
for(int i=0; i<(f.length()/3); i++) {
filter[i].append(f.c_str(),((i*3)+3)); ///////////////////////////////////////////////////////////////////////
}
}
};
is the class where it's being called. Protection x("Nelson", "Abso1uTPwrInsta11U$E1234qwerDS", ANTISPAM, 1); is how I'm calling it-and ANTISPAM is valid. I used throw...catch to learn that I was using append wrong somehow...can anyone help?
When given a choice between a vector<string> and a dynamically allocated array of strings, there is never a reason to go with the latter. vector<> implements a dynamic array in the first place, and thus the two choices are equivalent. The difference is that vector<> manages the memory for you whereas with the dynamic array you have to manage it.