databasecompilationfortran

Entering data in Mycompiler (Fortran) by data file


Is it possible to enter data in Mycompiler (Fortran) through a text data file? (By "Mycompiler" I mean the online IDE.)

I was not able to accomplish this type of data entrance. I am not sure if Mycompiler only permits one enter the data through keyboard or the usual way by using ASCII files is also allowable. I am begining with Mycompiler and that is a doubt of mine so far.


Solution

  • You can't attach to a file for input to this online compiler. (If a remote server could get direct access to the files on your computer that would be a bit of a security nightmare. Nor would any free online service be ready to give you filespace gratis to upload huge data files.)

    You can create a text file with your input and cut-and-paste it into the input box. Try:

    program main
        implicit none
        character(len=50) name
        read( *, * ) name
        print *, "Hello " // name
    end program main
    

    All input is limited to stdin (the first '*' in the above), so you won't be able to use multiple input (or output) units.

    However, why don't you just install gfortran (as part of the gnu compiler suite) and/or ifort and ifx (from the free Intel compiler suite)? Then you don't even need an internet connection. You don't need a fancy IDE to create Fortran source files: a simple editor like Windows notepad would do.