Fortran Solving Fortran Input File Problem - B

AI Thread Summary
The discussion revolves around a programming challenge involving the management of key parameters in code. The user seeks to move key parameters from the type declaration section into an external input file for easier access. However, they face a dilemma where certain variables, particularly arrays, cannot be defined until these parameters are known. The program structure restricts the use of file operations, such as opening an input file, before declaring global variables. This creates a circular dependency that complicates the initialization process. A response suggests that the user could use a straightforward approach to open the file and read the parameters, implying that there may be a misunderstanding of the existing code structure. The conversation highlights the need for a solution that allows for the dynamic definition of variables based on external input while adhering to the constraints of the programming environment.
Nrets
Messages
1
Reaction score
0
Hey guys,

I am wondering if anyone could help me with a simple problem.

I want to remove key parameters from the "type declaration/parameter" portion of my code and into an external input file for easy access. The problem is, many of my variables (such as arrays) can't be defined until these key parameters are known. However, the program structure disallows a function like "open" in or before the array declarations. In other words, I can only open an input file after I have defined all my global variables. But I can't define all my global variables without opening the input file.

There has to be a solution, yes? Any help would be appreciated.

- B
 
Technology news on Phys.org
Sorry, I did not understand how you could not simply put some code like

Code:
Open (Unit=1, File='File.dat')
Read(1,*)var1
Read(1,*)var2
.
.
.
Read(1,*)varn
Close (Unit=1)

Mainly because you already use some Write\Reads, if I'm guessing right. Maybe some allocatable array? Could you show this bit of code?
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
25
Views
3K
Replies
12
Views
3K
Replies
5
Views
2K
Replies
5
Views
5K
Replies
1
Views
3K
Replies
19
Views
6K
Back
Top