Skip to content

Instantly share code, notes, and snippets.

View alexmyczko's full-sized avatar
🏝️

Alex Myczko alexmyczko

🏝️
View GitHub Profile
@xaviervia
xaviervia / gist:6087296
Last active January 22, 2024 13:23
Reading the output from a shell command in Objective-C
- (void) doIt {
// Define the command name and the arguments array (the nil at the end is needed)
NSArray *arguments = [NSArray arrayWithObjects:@"--some-argument", @"--another", nil];
NSString *command = @"do-something-shell";
// Setup the NSTask for the command execution
NSTask *task = [[NSTask alloc] init];
task.launchPath = command;
task.arguments = arguments;
#import <Foundation/NSObject.h>
@interface Fraction: NSObject {
int numerator;
int denominator;
}
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;