//写一段监视剪贴板内容的程序
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <pthread.h>
#include <semaphore.h>
int main(int argc, char *argv[])
{
int fd = open("/dev/clipboard", O_RDONLY);
if(fd < 0)
{
perror("open");
return -1;
}
char buf[1024];
while(1)
{
memset(buf, 0, sizeof(buf));
read(fd, buf, sizeof(buf));
printf("%s\n", buf);
sleep(1000);
}
return 0;
}
写一段监视剪贴板内容的程序
最新推荐文章于 2024-07-09 14:56:12 发布