3 messages in net.java.dev.jna.usersRe: [jna-users] using iostream with JNA
FromSent OnAttachments
Aekold HelbrassJun 18, 2009 5:19 am 
Timothy WallJun 18, 2009 6:58 am 
LYou...@gkservices.comJun 18, 2009 8:39 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] using iostream with JNAActions...
From:Timothy Wall (twal@dev.java.net)
Date:Jun 18, 2009 6:58:25 am
List:net.java.dev.jna.users

On Jun 18, 2009, at 8:20 AM, Aekold Helbrass wrote:

Hi All! I want to read chars from standard console input withour need to press enter button, as I can understand it's done in C like this:

#include <iostream> using namespace std; int main() { char ch; while ( (ch = cin.get()) != EOF) { cout << "ch: " << ch << endl; } return 0; }

But how can i invoke cin.get() using JNA? All valiants I tried did not worked.

That's how you might write it in C++, not C. JNA won't help you much with C++.

Even if it did, there is no cross-platform "read single character" function, in either C or C++. You have getch() or getche() on windows, but you'll need to do extra work for *nix systems.

See also http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.17