Some guy named stoned_coder ansvered on one of my question which was about fastnes . Here's the code he commented
Code:AnsiString TFileHandle::Load() const { char *Text = new char[1]; Text[0] = '\0'; char *Temp; char Char; unsigned int Lenght; ifstream File(itsName.c_str()); if (File.is_open()) { while (File.get(Char)) { Lenght = strlen(Text); Temp = new char[Lenght + 2]; strcpy(Temp, Text); Temp[Lenght] = Char; Temp[Lenght + 1] = '\0'; delete [] Text; Text = Temp; } } File.close(); return Text; }My NEW ( ) question is, if you use a String class the that code would without doubt include the same amount of "new" if you get me. Because how else are you going to make a array longer as needed. Then you might say why don't just make the array as long as you need it, but when you don't know how long you need it. (A file can be very short or long )You are "newing" one char at a time and you want this to e fast. Id totally rethink your approach and try again. Each call to new will cost you in efficiency terms about 8* a normal function call. So "newing" a single char for everyone read would really slow this up like glue.
Hope my text is readable, but I'm as always kind of timelimeted.