This question was closed and the message instructs me to edit it or delete it, and possibly post a new question; however, the system won't permit me to delete it and states others have put in too much effort for it to be deleted.
That's fine. If interested, @jfs provided the answer in a comment here. I appreciate the comments and the answer in this post, but should point out that browsers can exchange messages with C programs through the native messaging API alone. Nothing else is required by the developer apart from that in the OS-specific set up instructions provided in this MDN document and this MDN document. Even I got that part to work, although my C question was quite novice.
Thanks.
I'm trying to set up native messaging between a browser extension and a native c program. I'm pretty sure I understand the extension side and have it ready to test; but I haven't used C since Borland Turbo C was popular.
Would you please point me to information on how the stdin
and stdout
in C are used to receive and post messages from the browser? I'm sure I'm just looking in the wrong places but all I've come across relate to the keyboard and files, but not input from another program. I think I can manipulate the information once I get it, but I'm stuck on the first step of the equivalent of setting up a communication port listener.
Thank you.
I'd like to do something like this done in C# but I don't follow what the equivalent is in C for the code below in public static JObject Read()
:
var stdin = Console.OpenStandardInput();
var lengthBytes = new byte[4];
stdin.Read(lengthBytes, 0, 4);
This question is similar to what is taking place. The browser is functioning as this poster's Java program, in that it opens the C progam and passes it data. I've just been confused on whether or not stdin
has to redirected from the keyboard to something related to this pasing of data or if it will just pickup any data sent to it. And, how is the keyboard input not picked up in the interim?