You can't init an object more than once (well not an intended use). You do:

SimParamnames = [NSMutableDictionary dictionary];

and later:

[SimParamnames initWithContentsOfFile: aFile];

which are both initializing the object. The second init is either being ignored or perhaps corrupting the object. If you want a mutable dictionary of a file's contents you'll have to make a new one with [NSMutableDictionary dictionaryWithContentsOfFile:filePath].


[SimParamnames removeAllObjects] ;
[SimParamnames initWithContentsOfFile: aFile];

might work better as:

[SimParamnames release];        //throw away the old dictionary
SimParamnames = [[NSMutableDictionary alloc] initWithContentsOfFile:aFile]; //make a new one from aFile

On May 28, 2008, at 1:58 AM, Leslie Smith wrote:

in a later method
        NSArray *filesToOpen = [oPanel filenames];
      int i, count1 = [filesToOpen count];
      for (i=0; i<count1; i++) {
                        NSString *aFile = [filesToOpen objectAtIndex:i];
                        printf("%s\n", [aFile UTF8String]) ;
                        [SimParamnames removeAllObjects] ;
                        [SimParamnames initWithContentsOfFile: aFile];
                        NSLog(@"SimParamnames contains %d values", 
[SimParamnames count]) ;
                        xxx = [NSMutableDictionary 
dictionaryWithContentsOfFile: aFile];
                        NSLog(@"SimParamnames contains %d values", 
[SimParamnames count]) ;
                        NSLog(@"xxx contains %d values", [xxx count]) ;
                        result = 100 ;
      }

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to