views:

201

answers:

1

Hello,

I am working as an Iphone developer since 5 months but never ever i have used NSfilemanager class. Apple has documentation but still i am not cleared about its use. My question is that can anybody tell me(with example) how and when to use the NSfilemanager class ? Any help will be appreciated. Thanks.

+1  A: 

NSFileManager is used to perform read write operations on file, to save a file on your application.To check whether the specified file is present on that location or not.

NSFileManager *fileManager = [NSFileManager defaultManager];
// Get the path to the database in the application package
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];

// Check if the database has already been created in the users filesystem
success = [fileManager fileExistsAtPath:databasePath];

this is an example for checking the file existing.

Chandra Prakash