Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]How to save a file with "user input" file name[/b] 1

Status
Not open for further replies.

etileyli

Programmer
Oct 18, 2007
2
TR
I want my FORTRAN program's .exe file to ask the user output file name. After user input a file name, a file with that name should be created in desired directory. How can I do this??
Thanks for your interests...
 
I don't know whether I understand you well.
Just read a string and use that string as the file name.

CHARACTER*80 MyString

READ(*,*) MyString

OPEN(UNIT=1,FILE=MyString(1:LEN(MyString)))
 
Thanks a lot GerritGroot. Actually I don't know FORTRAN very well so far. So easy problems like this could take most of my time. You can't even guess how did these answer help me. Thanks again a lot...
 
You're welcome. I've had many answers on this forum myself, so I'm happy to help another one for a change :)

If you're looking for some F77 info, you maybe interested in this link:


By the way, when I said:
Code:
MyString(1:LEN(MyString)))
I meant:
Code:
MyString(1:LEN(TRIM(MyString))))
TRIM takes away the trailing blanks in MyString
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top