char *text; int ptrpos; int max_char_width = /*you can figure out how to do this */; if (strlen(text) <= max_char_width) return(); while ( strlen(text) > max_char_width) { ptrpos=max_char_width; while( ( ptrpos > 0 ) && (text[ptrpos] != ' ')) ptrpos-- ; /* draw text up to ptrpos here*/ text += ptrpos; }