How can I set a pointer to a C array in my constructor?
@implementation NSBufferedInputStream {
char *buffer;
int bufferSize;
}
- (id)initWithFileAtPath:(NSString *)path
{
self = [super initWithFileAtPath:path];
if (self) {
bufferSize = 100;
buffer = char[bufferSize]; // ERROR: Expected expression
}
}
@end
If you truly need a dynamically-sized array,
Otherwise, if your array size is known at compile time, just change your ivar from
char *buffer;to: