My darn code keeps crashing, what am I doing wrong? I have a class with the follwoing method:

void BBSNode::AddToBuffer(char *buffer) {
	//strcat((char*)inputBuffer, (char*)buffer);
	sprintf("Got Data: %s\n", buffer);
}

I'm calling the method like this:

nodes[nodeID].AddToBuffer(sockBuffer);

sockBuffer was declared like ...

char sockBuffer[IN_BUFFER_SIZE];

Now, when I run the program and it calls AddToBuffer it crashes with a Bus error.

How am I calling this method wrong?

I'm using XCode 2.0

Thanks!

I am retarted.

I realized I was using sprintf, not printf.

Duh! :) Thanks for your views everyone.

sprintf("Got Data: %s\n", buffer);

The above is wrong. Was it just a posting error or is it really like that in your program ?

sprintf(InputBuffer, "Got Data: %s\n", buffer);

or

strcpy(InputBuffer,"Got Data: ");
strcat(InputBuffer,buffer);

I ment to do: printf, not sprintf.

Thanks.