views:

31

answers:

1

Hello,

Just before i had asked you about how to take input from file into hashtable by specifying key , i'm really sorry , actually i need to seperatly identify the key and value from text file and put it into my hashtable. i.e

This is text file:
LENOVA = Class_Name
DELL = Class_Name
WIPRO = Class_Name
SAMSUNG = Class_Name

Ineed to take it as key/Value pairs into hashtable, and finally load the class from hashtable.

In HashTable it has to store in this way:
Key         Value
LENOVA    Class_Name
DELL      Class_Name
WIPRO     Class_Name
SAMSUNG   Class_Name

How to do this in Objective-C?? Give me some idea to proceed.

A: 

If you are allowed to alter the input text file so that it contains:

"LENOVA" = "Class_Name";
"DELL" = "Class_Name";
"WIPRO" = "Class_Name";
"SAMSUNG" = "Class_Name";

Then you can simply do:

NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:@"myfile.txt"];
dreamlax
Great!!!! I'm able to access value for key through NSLog(@"DICOM=%@,[dict objectForKey:@"DICOM"]);Thanks Dreamlax... Can i view this hashtable in XCode ?? i mean in what format will it be stored? where will it be stored??
suse