Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29279 Discussions

How detect if program is run interactively or in batch

gerard_doorman
Beginner
508 Views
A DOS console program may be run interactively with user input provided by the keyboard, or in batch mode, in which case user input is provided from a file. In certain situations the program should behaved differently, and I want to check in which mode the program runs. We used to do this by using INQUIRE to check if UNIT 5 is connected to CONIN$, I believe this worked in older versions, but anyway it does not work now (UNIT 5 is connected to CONIN$ in both situations). I have gone through all the intrinsic functions, but cannot find any that solves this. So how should this be done?
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
508 Views
Take a look at

GetStdHandle(STD_INPUT_HANDLE)

and

GetFileType()

APIs (USE DFWIN)

Jugoslav
0 Kudos
Reply