Hello,
Part of the app I'm writing is basically the commandline with an aqua makeover. However, system() function isn't behaving like I would expect. The code given at the bottom is the for the command action, which is whenever someone presses enter from the command field or presses the Send button in the gui. However, when I type "w" (then Send) and then "vim" (then Send) the following errors are reported. I get these same errors no matter
[Session started at 2005-05-28 19:24:39 -0500.]
sh: line 1: \240\364: command not found
sh: line 1: \240\364: command not found
I know all my outlets, buttons and actions are all properly connected. I am also having a problem with outputting to the NSTextView object called resultTextView. For instance, the code seems like it should output "TEST" every time a command is given, but instead it does nothing.
- (IBAction)command: (id)sender
{
NSString *cmd = [[NSString alloc] init];
NSMutableString *result = [[NSMutableString alloc] init];
cmd = [commandField stringValue];
system((char *)cmd);
[result setString:@"TEST"];
[resultTextView insertText:result];
}
Sorry if this is really amateur...I tried looking stuff up on the apple website and other posts, but it didn't help all that much. I figured I'd get some people's input. Thanks!