I'd like to know how to make work newline control character inside c-string returned by a sqlite3_column_text. For example, this is the text returned from a query to a sqlite database:
"Lorem ipsum\ndolor sit amet,\nconsectetur\nadipiscing elit."
and this is the code I use to get it:
char *body = (char *)sqlite3_column_text(statement, 1);
NSString *str = (body)?[NSString stringWithUTF8String:body]:@"";
The problem comes when I try to print it, because in return this:
Lorem ipsum\ndolor sit amet,\nconsectetur\nadipiscing elit.
instead of:
Lorem ipsum
dolor sit amet,
consectetur
adipiscing elit.
Using the same text but returned from a string column in Core Data works as intended, but I don't know why is doesn't in sqlite3. I hope someone can give directions because is quite frustrating.