osx - How do I save data to the clipboard on MacOSX in C -


this question has answer here:

i'm attempting work around nasty problem involves being locked down in cups printing service filter. application unable write outside of it's domain filter program. & wanted give saving string clipboard go, out of program , readable another. exchange happen user won't know occurred.

so way write xdata x clipboard on osx in c?

mike

as far can tell, os x provides interface clipboard functions in objective c, not plain c.

however, can open pipe pbcopy command line utility follows:

#include <stdio.h> int main() {   file *p = popen("/usr/bin/pbcopy","w");   fprintf(p,"hello world");  /* << copy clipboard */   pclose(p);   return 0; } 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -