Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kelmon

macrumors 6502a
Original poster
Mar 28, 2005
733
0
United Kingdom
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:

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.