I'm trying to join an array of file paths into a single string delimited by tabs, and I'm getting strange output from NSLog. Here's my code:

// gcc -o stringtest test.m -framework Foundation
// ./stringtest

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool *pool;
    pool = [NSAutoreleasePool new];

NSArray *files;
files = [NSArray arrayWithObjects: @"/Users/kevin/Desktop/foo.txt", @"/Users/kevin/Desktop/bar.png", @"/Users/kevin/Desktop/baz.txt", nil];

NSString *filestring = [files componentsJoinedByString:@"\t"];

NSLog(@"%s", filestring);

[pool drain];
    return 0;
}


Here's the result:

Macintosh:Desktop kevin$ ./stringtest
2009-11-22 22:25:47.251 stringtest[33157:10b] †dx†≠

I have no idea what "†dx†≠" is. I'd expect something like this:

/Users/kevin/Desktop/foo.txt /Users/kevin/Desktop/bar.png /Users/kevin/Desktop/baz.txt

Any idea what the problem is? I've looked at the methods and various websites and can't find what I'm doing wrong.

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to