hi am trying to create a plist of my calculations but it turns out the list is empty....pls help here is my code.is there any othe way to write strings to a file other than this...
-(float)calculate
{
if(!self.operatorLabel.text.length)
return self.operand2;
float result=0;
switch([self.operatorLabel.text characterAtIndex:0])
{
case '+':result=self.self.operand1+self.operand2;
break;
case '-':result=self.operand1-self.operand2;
break;
case '*':result=self.operand1*self.operand2;
break;
case '/':if(self.operand2==0)
divideByZeroFlag=true;
else
result=self.operand1/self.operand2;
break;
default:self.operand1=0;
result=self.operand2;
break;
}
if(!divideByZeroFlag&&self.operand1!=0)
{
NSString *data=[NSString stringWithFormat:@"%g%@%g=%g",self.operand1,self.operatorLabel.text,self.operand2,result];
NSMutableDictionary *dat;
[dat setObject:data forKey:@"nthing"];
[dat writeToFile:@"memory.plist" atomically:YES];
}
return result;
}