- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re:
Is there some sort of wildcard search function in C? Detailed explanation. [code]Phrase: <blah="*" uid="ekdopakek"> So let's just say we've got this 48764546545blah<blah="whatever" uid="ekdopakek">blahblahblah I'm looking for a function that will return the whatever, and just the whatever (nothing else). Thanks![/code] |
|
[code] #include <iostream> using std::cout; using std::endl; class aClass { public: aClass() { this->aString = new char [1];; this->aString[0] = '\0'; this->length = 0; } ~aClass() { cout << "Destructor" << endl; delete [] this->aString; } aClass(const char *); const aClass& aClass::operator=(aClass &); private: int length; char * aString; }; … |
|
Again, I don't know what I've done wrong. [code] #include <iostream> using std::cout; using std::endl; #include <cstring> using std::strcpy; using std::strcat; #include <cstdio> using std::sprintf; void destroyMultiCharArray(char * * anArray, int size) { for (int i = 0; i < size; i++) { delete [] anArray[ i ]; } delete … |
|
[code] #include <iostream> using std::cout; using std::endl; #include <cstring> using std::strcpy; using std::strcat; #include <cstdio> using std::sprintf; int main() { char * lb = "(?:[a-z90](?:-?[a-z90]+)+)"; int lbLen = strlen(lb); char * sbFrmat = "(?:%s(?:\\.%s){0,4})"; int sbFrmatLen = strlen(sbFrmat); int sbLen = (lbLen * 2) + sbFrmatLen; char sb[sbLen+1]; sprintf(sb, sbFrmat, … |
|
I get a segfault when I run the following. Seems to fail at strcpy. [code] #include <cstring> using std::strcpy; int main() { char * word = "word"; strcpy(word, "what"); } [/code] If I change char * word to char word[], it's fine. I thought that both declarations effectively do the … |