I want to write the contents of an array to a text file in my iPhone application. I can load the array from the text file but i want to allow deleting of content through the arr
Write the contents of your original array as shown below:
[firstArray writeToFile:@"/Users/sample/Untitled.txt" atomically:YES];
Whenever you want to retrieve and modify the array, retrieve the contents of the file int an NSMutableArray:
NSMutableArray *myArr = [NSMutableArray arrayWithContentsOfFile:@"/Users/sample/Untitled.txt"];
[myArr removeLastObject]; //Any modification you wanna do
[myArr writeToFile:@"/Users/sample/Untitled.txt" atomically:YES];