NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];
fileName = [documentsDirectoryPath stringByAppendingPathComponent:@"user.txt"];
NSFileHandle *myHandle = [NSFileHandle fileHandleForUpdatingAtPath:fileName];
[myHandle seekToEndOfFile];
NSData *dataName = [uname dataUsingEncoding: NSUnicodeStringEncoding];
if ([dataName writeToFile:fileName atomically:YES])
NSLog(@"writeok");
[myHandle seekToEndOfFile];
** I edited the question. Now I am using NSFileHandle. Still the problem persist.
I using the following code to write in a file. The file does not get updated.
Is there any problem with the code?