Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About ALH

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ALH

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

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

    C++ characters

    U mean like this? #include <iostream.h> int main() { for (int i = 0; i<=255; i++) cout << "Character:" << (char)i << " Dec:" << i << endl; }
  4. ALH

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

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

    C++ Problem, Finally!!

    That's good to know, thanks! ALH
  7. ALH

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

    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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!