- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just installed ifort version 8.0 on my Debian GNU/Linux (kernel 2.4.25) system.
I wrote a test program:
PROGRAM hello_world
real :: num
print *, "Input a number: "
read *, num
print *, "You typed ", num, ". Ain't that special?"
END PROGRAM hello_world
I compiled the program with:
$ ifort test.f90
And ran the program:
$ ./a.out
Input a number:
42
You typed 42.00000 . Ain't that special?
Question 1:
If you look closely, there are spaces in front of each line of output. A space in front of " Input" and a space in front of " You", even though I didn't have that space in the string I wanted to print. What are those spaces doing there?
Question 2:
Why are those newlines being generated? I didn't specify a ' '. Do I need to surpress automatic newlines? I assume there HAS to be a way to do something like:
Input a number: 42
instead of what happens with automatic newlines:
Input a number:
42
Question 3:
Besides the strange whitespace in front of each line, there's a strange space around the real number 42:
You typed 42.00000 . Ain't that special?
Four spaces in front of "42.00000" and 5 spaces after it. Why are those spaces there?
Question 4:
When I control C when the program expects input, I get some very strange output:
$ ./a.out
Input a number:
forrtl: info: Fortran error message number is 69.
forrtl: warning: Could not open message catalog: ifcore_msg.cat.
forrtl: info: Check environment variable NLSPATH and protection of /usr/lib/ifcore_msg.cat.
I assume "rtl" stands for the Fortran run-time library. Does this mean something's not installed correctly? Installation was a bit of a bear since I'm on a non-rpm system, but I thought everything went OK. Maybe not.
Any hints/advice/suggestions on this strange info and warning message?
Thanks!
Pete
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the output of the program, ignore the double quotes. I'm using them to try to preserve the initial spaces:
"$ ./a.out"
" Input a number:"
"42"
" You typed 42.00000 . Ain't that special?"
Hopefully that will preserve the wierd spacing problems I mentioned in the previous post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
write (*,"(A)",advance="no") "Input a number: " read (*,*) num
SETENV NLSPATH opt/intel/compiler80/lib/ifcore_msg.cat/%N (note the /%N at the end)
You may want to pick up a good book on the Fortran 95 language to help with understanding Fortran I/O.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the awesome reply. I really appreciate your excellent response.
I'm using bash, and it appears that my installation is under a slightly different directory. If anybody reads this in the future, here's what I used:
export NLSPATH='/opt/intel_fc_80/lib/ifcore_msg.cat'
As for my Fortran questions, I've been reading "Fortran 90 Programming" by Ellis, Philips and Lahey, and it seems like an excellent book.
I guess my problem is that Fortran 90 looks so much like C (compared to the Fortran 77 code I've seen out there which looks like it belongs in the Smithsonian Museum of history) that I've been skimming rather than reading.
Fortran 90 looks like a _really_ user friendly language. As a C programmer, I can really appreciate some of the conveniences that you don't normally see in non-OOP compiled languages.
I mean, string handling is a breeze (not to mention memory boundary safe). The "implied DO" looks like it belongs more in a language like perl or Tcl rather than a compiled language.
So far, Fortran 90 seems like a really awesome language. I'm really enjoying it. I've looked at my book's TOC, and it looks like I'll learn more about PRINT and READ formats in chapter 8 (which again reminds me of Perl).
Again, thanks!
Pete
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page