i am working on exercise 3 from chapter 19 from a programming book by Stephen Kochan
here is the exercise from the book:
here is the program which i got off this site i called it exc3chap19.m
the program compiled to an executable without any problems.
just wondering what this program is supposed to do?
i ran the program in terminal and it appeared to do nothing.
is there a way to view this property list?
here is the exercise from the book:
Code:
The glossary in Appendix A has been stored online as a traditional property list at the URL http://www.kochan-wood.com/examples/glossary.pl Write a program to read the glossary into a dictionary object and then display its contents.
here is the program which i got off this site i called it exc3chap19.m
Code:
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSArchiver.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSURL.h>
#import <stdio.h>
int main (int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *glossary;
NSEnumerator *keyEnum;
NSString *url = @"http://www.kochan-wood.com/examples/glossary.pl";
id key;
glossary = [NSDictionary dictionaryWithContentsOfURL:
[NSURL URLWithString: url]];
keyEnum = [glossary keyEnumerator];
while ( (key = [keyEnum nextObject]) != nil )
printf ("%s: %s\n", [key UTF8String],
[[glossary objectForKey: key] UTF8String]);
[pool release];
return 0;
}
the program compiled to an executable without any problems.
just wondering what this program is supposed to do?
i ran the program in terminal and it appeared to do nothing.
is there a way to view this property list?