static void RomInfoCopyToClipboard (void) { OSStatus err; PasteboardRef clipboard; PasteboardSyncFlags sync; CFDataRef cfdata; char text[1024]; RomInfoBuildInfoText(text); err = PasteboardCreate(kPasteboardClipboard, &clipboard); if (err == noErr) { err = PasteboardClear(clipboard); if (err == noErr) { sync = PasteboardSynchronize(clipboard); if (!(sync & kPasteboardModified) && (sync & kPasteboardClientIsOwner)) { cfdata = CFDataCreate(kCFAllocatorDefault, (UInt8 *) text, (CFIndex) strlen(text)); if (cfdata) { err = PasteboardPutItemFlavor(clipboard, (PasteboardItemID) 1, CFSTR("com.apple.traditional-mac-plain-text"), cfdata, 0); CFRelease(cfdata); } } } CFRelease(clipboard); } }
static void RomInfoCopyToClipboard(void) { OSStatus err; char text[2048]; RomInfoBuildInfoText(text); err = ClearCurrentScrap(); if (err == noErr) { ScrapRef scrap; err = GetCurrentScrap(&scrap); if (err == noErr) err = PutScrapFlavor(scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, strlen(text), text); } }