I have already created a project to read a file and also to display it. Now i need to create a hashtable and access the data from the created file( text file ) in Objective-C for iPhone-OS. Pls do give suggestion…
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question does not make sense.
A hash-table (I think you’re referring to what we call an
NSDictionary, or a set of key-value pairs) is a data structure.A file is a series of bytes that can be interpreted in a multitude of ways. It can be interpreted as audio, video, or textual data. It can be interpreted as something entirely different.
So you want to “create a hashtable”. That’s easy enough:
And you want to access the data from the created file:
What you do beyond that is unspecified in your question.
EDIT:
You want to know how to access the file contents “automatically”. Well, using the NSString method above, you can parse it yourself. Using the NSFileHandle method you can read in the bytes yourself. The only way to get a file to automatically convert into an NSDictionary is to use
-[NSDictionary initWithContentsOfFile:]. However, in order to use that, you have to have previously used-[NSDictionary writeToFile:atomically:]to create the file.