how to convert object of an structure to an nsstring?
views:
37answers:
1
A:
I'm not sure if I understand you correctly, but if you mean C-structures then try this:
//definition
struct RECORD {
char c;
int a;
float b;
};
//usage
struct RECORD rec;
rec.c = 'x';
rec.a = 5;
rec.b = 7.1;
NSLog(@"%c",rec); //first element od the struct
NSLog(@"%d",&rec); //address of the struct
NSLog(@"%d",rec.a);
NSLog(@"%f",rec.b);
NSLog(@"%c",rec.c);
NSString* string = [NSString stringWithFormat:@"%d",rec.a];
NSLog(@"rec.a: %@ ",string);
Kacper86
2010-08-18 14:27:31