Im looking to text wrap text, this is what I have put together so far.
Basically I need to find a way to text wrap at a buffer length (say 50 char's)
I am having troubles getting things to work correctly, it seems that "shakes" pointers dont really work the same as C or C++ (hense the statement that shake is NOT C).
CODE
//Defined in the Input Node for shake
char *ShotNotes="Notes for this shot include lots of text, testing the ability to text wrap";
//////////////////
// body code
int i = 0;
int count = 0;
int count2 = 0;
int j=0;
char* divider = ' ';
int a = strlen(ShotNotes);
for(i= 0; i< (a); i++){
if(ShotNotes[i]==10||ShotNotes[i]==13) ShotNotes[i]='\0';
}
//count the splits
for(i=0; i<strlen(ShotNotes); i++){
if(ShotNotes[i]==divider) count++;
}
splitSize = count+1;
char** ShotNotesOutput[count+1];
for(i=0; i<count+1; i++){
ShotNotesOutput[i] = char[10];
}
for(i=0; i<strlen(ShotNotes)+1; i++){
if(ShotNotes[i]==divider||ShotNotes[i]=='\0'){
ShotNotesOutput[count2][j] = '\0';
j=0;
count2++;
} else {
ShotNotesOutput[count2][j++] = ShotNotes[i];
}
}
This is another method I am trying...
CODE
for( n=0; n < strlen( ShotNotes ); n++){
buffer++;
if( buffer > 50 ) {
//reset buffer
//start to truncate to next line
for ( m=n; m == 0; m--)
{
//search string for " " space and replace with return
if(ShotNotes[m] == ' ') {
ShotNotes[m] = '\n';
m = 0; // found space, dont need to check anymore
}
}
//buffer full, add 1 to bufferCNT
buffer=0;
bufferCNT++;
}
}