First one was too big and confusing.
The assignment requires that I create a function which has the following input:
output max length
the output string needs to be formatted in this manner:
1)every line indented with the amount of spaces specified in the indent length variable
2)all extra spaces ("I like to eat pie") removed ("I like to eat pie")
3)all unprintable characters ('\a', '\b', '\f', '\r', '\t') removed
4)newline created every line length
5)any words which don't fit into the first line is moved to the second.
r=wordWrap("the quick brown \t fox jumped over the lazy dog",s,149,3,12);
After the function call: r=any non zero value, and
s=" the quick\n brown fox\n jumped\n over the\n lazy dog\n"
I can remove all unprintable characters, but I have trouble with the extra spaces. I don't even want to think about how to read a word, store it to memory, then write it into the string, then continue.
I have an idea how to do some of the things I listed, but I'd appreciate any help.