What's a good way to store simple data that's used by a Command Line?
I'm new to both Mac and the C programming language; but, I recently installed Xcode, and I've been trying to figure somethings out..
Currently I want to work on making a small Command Line game. But I need to find a good way to store simple data, like strings and integers..
So, is there a way to store information in an XML f开发者_StackOverflow中文版ile through C? If so, would that be a good way to go about things? If not, what do you suggest?
For simple data you can use NSUserDefaults
.
Example where 32 is the:
int score = 32.
[[NSUserDefaults standardUserDefaults] setInteger:score forKey:@"CurrentScore"];
later:
score = [[NSUserDefaults standardUserDefaults] integerForKey:@"CurrentScore"];
See the documentation for NSUserDefaults, it can handle many types of data.
精彩评论