user1180395
user1180395

Reputation: 9

Newline in Objective C using Xcode 4.4

Has anyone had an issue besides me where /n didn't produce a new line in an output string? This is a starter program taken from "Programming in Objective C" Fourth Edition by Stephen Kochan. The code runs without error but prints /n instead of advancing a line which is contrary to the text. Is there an Xcode dialog setting I need to look at or something?

Thanks,

Michael

//  First programming example

#import <'Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        // insert code here...
        NSLog(@"Testing..../n....1/n....2/n....3");
    }
    return 0;
}

Upvotes: 0

Views: 4189

Answers (2)

Daniel
Daniel

Reputation: 23359

Escaping characters is when you use a backslash, not a forward slash, a new line is: \n and a carriage return is \r

/n is just... well "/n"

Upvotes: 4

su-
su-

Reputation: 3176

Newline character in Objective-C (and also many other programming languages...) is \n not /n.

Upvotes: 8

Related Questions