I want to read a file, line by line and then assign to each line a variable.
I have the following code: NSString *aFilePath= [[NSString alloc] initWithContentsOfFile:@"db.def"]; NSArray *lines = [aFilePath componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
char *server = [[lines objectAtIndex:0] UTF8String];
Here I get the following error: Initialization discards qualifiers from pointer target type
As far as I can see: lines objectAtIndex:0 returns id. I tried to cast it to NSString with no difference char *server = [[(NSString *) lines objectAtIndex:0] UTF8String];
I simply want to read a line and make it a char *. Please help.