LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-17-2011, 07:59 AM   #1
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Rep: Reputation: Disabled
Does gfortran has issue working with the file as I/P and O/P ??


Does gfortran has issue working with the file as I/P and O/P ??

It repeatedly shows
Fortran runtime error: Bad real number in item 1 of list input

I tried running the programme in silverfrost and it works fine.
Should I download g95 to fix the problem?
 
Old 06-17-2011, 08:20 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
gfortran should work well. What is the offending line of code? And what is the input file (binary or ascii text)? Please, show us the code, so that we can have a clue.
 
Old 06-17-2011, 08:23 AM   #3
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
gfortran should work well. What is the offending line of code? And what is the input file (binary or ascii text)? Please, show us the code, so that we can have a clue.
program work_file
implicit none
double precision ::x,y
integer::ln
open(8,file="w1.txt")
open(9,file="w2.txt")
do ln=1,10
read (8,*)x
y=x*10
write(9,'(2f10.2)')x,y
enddo
close(8)
close(9)
end program work_file
 
Old 06-17-2011, 08:27 AM   #4
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by parekhharsh_j View Post
program work_file
implicit none
double precision ::x,y
integer::ln
open(8,file="w1.txt")
open(9,file="w2.txt")
do ln=1,10
read (8,*)x
y=x*10
write(9,'(2f10.2)')x,y
enddo
close(8)
close(9)
end program work_file
As I said it works well with the Silverfrost in Win platform.
 
Old 06-17-2011, 08:32 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What is the content of w1.txt? I would like to test the program on my machine, if you don't mind.
 
Old 06-17-2011, 08:35 AM   #6
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
What is the content of w1.txt? I would like to test the program on my machine, if you don't mind.
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0

Content is as above. I am just a Fortran learner.
 
Old 06-17-2011, 08:39 AM   #7
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by parekhharsh_j View Post
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0

Content is as above. I am just a Fortran learner.
It worked. I guess the program which created "w1.txt" created the problem. Well thanks for your reply.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gfortran in SLED 11 ?? Kilam orez Linux - Newbie 9 11-24-2009 02:59 AM
gfortran for suse elnaz Linux - Newbie 2 11-07-2009 04:18 PM
Problem to Read Binary File with gfortran kdurgarao Programming 1 10-12-2009 02:26 AM
"gfortran:error trying to execute f951 and execvp: no such file or directorry kandhakumar Linux - Software 1 06-01-2009 09:37 AM
help gfortran mperez Programming 2 12-16-2007 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration