Amazon.com Widgets exercise 16-5
Welcome, Guest. Please login or register.
Did you miss your activation email?
June 19, 2013, 02:44:12 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Answers to Exercises
| | |-+  Chapter 16 (Moderator: sgg_admin)
| | | |-+  exercise 16-5
Pages: [1]   Go Down
Print
Author Topic: exercise 16-5  (Read 637 times)
mdziedzic
Newbie
*
Posts: 41



WWW




« on: December 15, 2009, 11:24:59 AM »

Code: (Objective-C)
#import <Foundation/Foundation.h>

@interface NSString (TempFiles)

+(NSString *) temporaryFileName;

@end

@implementation NSString (TempFiles)

+(NSString *) temporaryFileName
{
NSString *tempDir = NSTemporaryDirectory();
NSProcessInfo *proc = [NSProcessInfo processInfo];

return [tempDir stringByAppendingString: [proc globallyUniqueString]];
}

@end


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

NSString *newFileName;

newFileName = [NSString temporaryFileName];

NSLog(@"%@", newFileName);
   
[pool drain];
    return 0;
}
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.