NSString componentsJoinedByString--strange output
NSString componentsJoinedByString--strange output
- Subject: NSString componentsJoinedByString--strange output
- From: Kevin Walzer <email@hidden>
- Date: Sun, 22 Nov 2009 22:28:05 -0500
- Organization: WordTech Communications LLC
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 (email@hidden)
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:
This email sent to email@hidden