Thanks for your reply i did some modifications to my code but the more i look at this the less i understand at this point. I probeboly seem stupid for asking this but how is line 5 above a memory leak, ? I put some comments in the code to try to bether explain what am doing. (Trying to do.)

123456789101112131415161718192021222324252627282930

BuffSplit::BuffSplit(char* inBuffer, int inSize , int inBlockSize)
{ // complete buffer // total Size of buffer // size of the parts of buffer
Size = inSize; // sets the class veriable total buffer size
buffer = newchar[Size]; // allocate memory for the complete buffer
buffer = inBuffer; // sett class buffer to == inBuffer (I dont see the leak they are the same size and inBuffer is null terminated.)
blockSize = inBlockSize; // the size of equal part to devide the complete buffer in.char* tmpBuff; // buffer for the "sub string" parts of the complete buffer
tmpBuff = newchar[blockSize];
int res = 1; // down the method not relevantint X = 0;
for (; (X + blockSize) < fileSize; )
{
// So this is suposed to take a substring of size blockSize and place in // ttmpBuff go in to some methods jump x+blockSize so i start to take the new sub string// from X + blockSize +1 so i dont get the last char of the last sub string first in the next one.
strncpy(tmpBuff, &buffer[X], blockSize);
X = ( X + blockSize + 1); // next location to start sub stringing with size BlockSize
tmpBuff[blockSize + 1] = '\0';
//....methods()
res++;
totalUpRes = res;
}
totalUpRes = res;
}

> from X + blockSize +1 so i dont get the last char of the last sub string first in the next one.
make a desk test. Suppose that blockSize=4
You start at X=0 and copy 4 characters, so you copy buffer[0], buffer[1], buffer[2] and buffer[3]
In the next iteration you set X=0+4+1=5, missing buffer[4]

As you don't care about '\0' in the source, maybe you want `memcpy()' there.

Thank you for your replys i solved my problem now.
I did as you sad and wrote a desk test of this and thats what is working now. So i stile got the uncertenty of implimenting it in my project. But am an optimist and since it prodcues the results i want am gona look for the buf somewhere else in my application. Anyways..
Turns out the blockSize had some HUGE impact on the stabilaty in my application.