Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

How detect if program is run interactively or in batch

gerard_doorman
Beginner
516 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
516 Views
Take a look at

GetStdHandle(STD_INPUT_HANDLE)

and

GetFileType()

APIs (USE DFWIN)

Jugoslav
0 Kudos
Reply