Created
February 5, 2014 01:36
-
-
Save rweichler/8815967 to your computer and use it in GitHub Desktop.
pbcopy
This file contains 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 <UIKit/UIKit.h> | |
#include <stdio.h> | |
#define yeah() printf("%s\n", pb.string.UTF8String) | |
int main() { | |
@autoreleasepool | |
{ | |
UIPasteboard *pb = [UIPasteboard generalPasteboard]; | |
char buf[BUFSIZ]; | |
fgets(buf, sizeof buf, stdin); | |
char lastchar = buf[strlen(buf)-1]; | |
if (lastchar == '\n') { | |
// read full line | |
buf[strlen(buf) - 1] = '\0'; | |
pb.string = [NSString stringWithUTF8String:buf]; | |
yeah(); | |
} else { | |
// line was truncated | |
} | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment