02-28-2012 08:43 AM
04-22-2012 10:40 PM
int len = get_clipboard_data("text/html", &data);
if (len == -1)
fprintf(stderr, "Error in get_clipboard_data: %s\n", strerror(errno));
fprintf("Length: %i\n", len);
And I get the error:
Error in get_clipboard_data: No such file or directory
Is there really no documentation on how to use the cipboard in the NDK? Oy.
Not sure if set_clipboard_path is required. It's strange that is_clipboard_format_present returns true and yet get_clipboard_data blows up.
04-22-2012 10:47 PM
Try using get_clipboard_data("text.html", &data) instead, without the forward slash.
If that works, I'll tell you how I figured that out...
04-22-2012 11:05 PM
Interesting... but it results in the same behavior...
04-22-2012 11:06 PM
Also to note that if I use get_clipboard_path, it gives:
04-22-2012 11:14 PM
Yeah, I was just catching up to you on that. Same path here. Have you looked in it (via SSH) to see what's there?
On mine, when I've copied something in an AIR app text field, I get a file "text.plain" in that folder. I also tried replying to an email in the Messages app and selected a range of text there and copied it, and "text.html" and "text.url" both showed up. The text.url file contains "file:///" while the html one contains a bunch of HTML stuff containing what I clipped. Not sure what the text.url one is supposed to mean.
It's interesting you're getting a true result from is_clipboard_format_present(). I'm getting a zero result even with what I see in that folder.
04-22-2012 11:21 PM
Ah... hah! As soon as I wrote that I double-checked the clipboard.h file and you've mixed up the return value from that. Getting a true value actually means the format is NOT present. You get a zero if it's present.
* @return * 0 if it exists, -1 otherwise. errno is set.
I'm getting a zero whether I use "text.plain" or "text/plain" so maybe it's not an issue of using "." vs "/".
And get_clipboard_data() is working fine for me with "text/plain" in there, as well as "text.plain".