Created
September 4, 2010 00:11
-
-
Save atr000/564748 to your computer and use it in GitHub Desktop.
osxDictionary.m
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 <Foundation/Foundation.h> | |
#import <CoreServices/CoreServices.h> | |
int main(int argc, char **argv) { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
if (argc <= 1) { | |
printf("Usage: %s searchstring\n", argv[0]); | |
[pool release]; | |
return 1; | |
} | |
NSString *string = [NSString stringWithUTF8String:argv[1]]; | |
CFRange r = DCSGetTermRangeInString(NULL, (CFStringRef)string, 0); | |
NSString *res = (NSString *)DCSCopyTextDefinition(NULL, (CFStringRef)string, r); | |
NSLog(@"res: %@", res); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment