NSLog without new line

philip picture philip · Jul 14, 2010 · Viewed 8.8k times · Source

Is there any function that does what NSLog does but without the new line at the end?

Answer

tato picture tato · Aug 17, 2010

see this http://borkware.com/quickies/one?topic=NSString

excerpted from that page:

void LogIt (NSString *format, ...)
{
    va_list args;
    va_start (args, format);
    NSString *string;
    string = [[NSString alloc] initWithFormat: format  arguments: args];
    va_end (args);
    printf ("%s\n", [string UTF8String]);
    [string release];
} // LogIt

just customize the printf to suit your needs