Stupid question but I'm trying to develop a simple command-line based application that can be wrapped by a Cocoa GUI. My problem is reading in the input from the command-line and converting this input to an instance of NSString. The following is basically what I have so far:
The initial output looks good. However, the NSLog line is generating warnings in the compiler that "argument 1 of NSLog from incompatible pointer type" and the rest of the output is nonsense. Unfortunately, I'm having difficulty finding much information on getting input from the command-line so I'm hoping someone else has a bit more experience with this.
Code:
char seed[13];
NSString *seedString;
int nScanned;
do {
nScanned = scanf("%s", &seed);
if (nScanned == 1) {
printf("Input has been read successfully: %s\n", seed);
seedString = [[NSString alloc] initWithCString:seed];
int stringLength = [seedString length];
NSLog("Input as an instance of NSString: %@ with length %i\n", seedString, stringLength);
}
} while (nScanned == 1);
The initial output looks good. However, the NSLog line is generating warnings in the compiler that "argument 1 of NSLog from incompatible pointer type" and the rest of the output is nonsense. Unfortunately, I'm having difficulty finding much information on getting input from the command-line so I'm hoping someone else has a bit more experience with this.