Created
September 8, 2011 10:24
-
-
Save swdyh/1203094 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
#import <CoreServices/CoreServices.h> | |
int main(int argc, char *argv[]) | |
{ | |
NSString *word; | |
NSString *result; | |
if (argc > 1) { | |
word = [[NSString alloc] initWithUTF8String:argv[1]]; | |
result = (NSString *)DCSCopyTextDefinition(NULL, (CFStringRef)word, CFRangeMake(0, [word length])); | |
// NSLog(@"word: %@", word); | |
// NSLog(@"result: %@", result); | |
if (result) { | |
printf("%s", [result UTF8String]); | |
return 0; | |
} | |
} | |
return 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
gcc -o dict -Wall -fobjc-gc -O2 -std=c99 dict.m -framework carbon -framework cocoa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment