Bus error: 10 - segmentation fault - Conversion from string literal to 'char *'

Hi I have an OSX program that I have written in OSX 10.8.5, XCode Version 4.6.3 and of_v0.8.0_osx_release. When it works its great but it often crashes on launch.

The most common error is Bus error: 10 but I have also had Segmentation fault: 11 and debug always says “Couldn’t set thread priority.”

I think it might be something to do with the Conversion from string literal to ‘char *’ being deprecated. I think there are probably a few examples of this in my code and that could be causing problems.

For example is this wrong. It works but maybe its causing memory issues.

void testApp::drawNumbers(){
char dataStr[20]; // an array of chars
sprintf(dataStr, “%d %d %d %d %d %d %d %d”, tape[7], tape[6], tape[5], tape[4], tape[3], tape[2], tape[1], tape[0]);
franklinBook.drawString(dataStr, 105,335);
}

All my code seemed much more stable on OSX 10.5.8 and now I seem to have more problems. Are there some core changes I should be aware of.

The AddOns I am using are
ofxOsc
ofxXmlSettings
ofxBeatTracking

Any tips would really be appreciated.

Many thanks

Simon

Hey Simon,

I would guess it’s the buffer size of 20. You are storing 8 ints and 7 spacer chars, if each int is 2 digits long that’s 16 + 7 chars total. You could make the buffer bigger, or just use a stringstream instead…

stringstream dataStr;
dataStr << tape[7] << " " << tape[6] << " " << endl;
franklinBook.drawString(dataStr.str(), 105,335);

Thanks, Trent I am sure this helps.
I seem to have a heap of other troubles.
I hate upgrading

Cheers

Simon