• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About ALH

  • Rank
  1. Char* Problems

    Quote:Original post by Codorke It's not the problem i'm accessing the wrong memmory !!! he gives me the error right after this : cString* temp_error = new cString("Error - find_in_text()"); cString* temp = new cString(); int len = string->getStrlen(); if(len <= 1)return temp_error; char* text = new char[len+1]; strcpy(text, string->getString()); And not after : text[len+1] = '\0'; That's mainly because after declaring outside the boundaries of the array, the block list was messed... Be very careful when dealing with arrays. Regards, ALH
  2. Char* Problems

    I think DadleFish is correct. You have declared: char* text = new char[len+1]; Then you accessed: text[len+1] = '\0'; When you declare something like: char* text = new char[50]; U can access the positions 0 to 49, by accessing the 50th position, you are trespassing the original declaration. Wanna test? Try this: text[50] = '\0'; delete []text; // Error when attempting to destroy data... Regards, ALH
  3. C++ characters

    U mean like this? [Code] #include <iostream.h> int main() { for (int i = 0; i<=255; i++) cout << "Character:" << (char)i << " Dec:" << i << endl; } [/Code]
  4. how do you reset an array?

    Also, if you mean to change the array size you could do like this: int * array; // pointer to array array = new int[10]; // array, size 10. delete []array; // deallocating array from memory array = new int[15]; // array, new size 15... delete []array; // a good programmer always deallocate his/her stuff... And so on...
  5. C++ Problem, Finally!!

    Great articles Pete, in those 9 years or so of C/C++, I've never worked with namespaces worrying about platform compliances, not before learning it is a compliance itself. Living and learning always... TIA, ALH
  6. C++ Problem, Finally!!

    That's good to know, thanks! ALH
  7. C++ Problem, Finally!!

    Quote:Original post by glassJAw No! Bad ALH! Go to your room. Why that's bad? Be more explicit please... ALH
  8. C++ Problem, Finally!!

    What about remove 'using namespace std;' and replace '#include <iostream>' with '#include <iostream.h>'? Cheers, ALH
  9. Way cool! Good to see the old school didn't died...
  • Advertisement