在命令行中,pbcopy和pbpaste是您的好朋友: echo 'send' | pbcopy pbpaste > receive.txt 请查看Pasteboard Manager Reference和guide以了解如何在C语言中实现此功能。