Amazon.com Widgets Program 16.2
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 28, 2014, 07:22:25 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
| |-+ Program Examples
| | |-+ Chapter 16
| | | |-+ Program 16.2
Pages: [1] Go Down
Print
Author Topic: Program 16.2 (Read 1382 times)
TotalLuck
Full Member
***
Posts: 107



WWW Email




on: February 21, 2009, 03:04:17 PM

Code: (Objective-C)

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

   //   **************  16.2

NSFileManager *fm;
NSData *fileData;


fm = [NSFileManager defaultManager];

// read the file newfile2

fileData = [fm contentsAtPath: @"newfile2"];

if (fileData == nil )
{
NSLog(@"File read Failed!");
return 1;
}

// write the data to a new file

if ([fm createFileAtPath: @"newfile3" contents: fileData attributes: nil] == NO)
{
NSLog(@"Couldn't create copy!");
return 2;
}


NSLog(@"File Copy Sucessful!");


    [pool drain];
    return 0;
}
[/pre]
Logged

Apps available on  iTunes store:
"ADACode"  iPhone and iPad versions, "ADAGuidelines" iPhone & iPad versions,  "Rehabilitation Act of 1973" for iPhone
"APokerTimer" now for iPhone http://bit.ly/h1fAJp
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.