Using C function in Tango - Simple solution?
    Fabian Classen 
    classen.fabian at googlemail.com
       
    Wed Feb 24 11:46:15 PST 2010
    
    
  
Hi
I am new in D.
I've the following problem. I want to use a old function out of the C 
programming language. I'm using D, with the dmd compiler, and the Tango 
lib. My "dirty" solution is the following:
<code>
version (Tango) extern (C) int getchar();
void main() {
	char quit = '\0';
	while (quit != 'q') {
		quit = getchar;
	}
}
</code>
But I believe the first line is too inconvenient.
Are there any better solutions to use C functions with the Tango lib.
I'm looking forward to your answers and I would be very happy with a few 
code exampes.
Greetings from Germany
Fabian Classen
    
    
More information about the Digitalmars-d-learn
mailing list