Read key from keyboard during run time in unix fortran

I am convering visual fortran windows version to Unix

Portland Fortran version.
Is there any function available in Portland Fortran unix
version to read any key from keyboard during program run
time so that I can use the key character to do different
operations.

Hi Kolluru,

Maybe I’m not understanding the question, but can’t you use the standard Fortran READ statement to get input from the keyboard?

  • Mat

Hi Mat,
I am not looking for Read command. During the running of a simulation, I would like to capture any interruption by user pressed key and do specific actions. I have used CharQQ type of commands in Comaq and Intel. I am looking for similar commands to handle key interruption. I am looking for such commands in unix. One possibility to write c code and hook it up with unix fortran. Have you come across such code or does PG has any new command to do this operation.

If I want to hook up c code with fortran what are the c libraries that I should use during linking.

Thanks
Venkat

Hi Venkat,

I’ve never done this before myself so another user might be better to help. You can do Callbacks in Fortran so it shouldn’t be a problem, it’s just a matter of finding the right UNIX call to register the call back routine and issue the interrupt when a key is pressed.

Maybe one of the Graphic/Windowing packages like GLUT, which you can interface via F90GL (http://www.pgroup.com/resources/f90gl/f90gl129_pgi60.htm), can help?

  • Mat