A collection of basic/generally desirable code I use across multiple C++ projects.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
434 B

#include <AppKit/AppKit.h>
#include <Foundation/Foundation.h>
int Copy(const char* stuff) {
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
NSInteger changeCount = [pasteboard clearContents];
NSString *nsstring = [NSString stringWithUTF8String:stuff];
NSArray *objectsToCopy = @[nsstring];
BOOL OK = [pasteboard writeObjects:objectsToCopy];
if (OK) {
return 1;
}
return 0;
}