In my Mac OS app I have NSTask calling a Python script, which then returns "connected" via NSPipe. I then read the data in my Obj-C class, and put it in a string:
NSMutableData *data = [[NSMutableData alloc] init];
NSData *readData;
while ((readData = [readHandle availableData])
&& [readData length]) {
[data appendData: readData];
}
NSString *aString;
aString = [[NSString alloc]
initWithData: data
encoding: NSASCIIStringEncoding];
NSLog(@"append%@me",aString);
Later when I try to concatenate the output with another string, I can't - it prints on another line:
appendconnected
me
And also, I can't test the string with:
if ([string isEqualToString:@"connected"]) {
NSLog(@"yes");
} else {
NSLog(@"no");
}
it shows that they are not equal, although they are!
Why is it?