Home > Archive > Fortran > May 2005 > a.out file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| wiggy13 2005-05-27, 4:01 pm |
| I would like to know how to > a.out infile return to run and
not a.out return, then infile return
| |
| Rich Townsend 2005-05-27, 4:01 pm |
| wiggy13 wrote:
> I would like to know how to > a.out infile return to run and
> not a.out return, then infile return
>
Cottleston Cottleston Cottleston Pie,
A fly can't bird, but a bird can fly.
Ask me a riddle and I reply
Cottleston Cottleston Cottleston Pie.
Cottleston Cottleston Cottleston Pie,
Why does a chicken? I don't know why.
Ask me a riddle and I reply
Cottleston Cottleston Cottleston Pie.
Cottleston Cottleston Cottleston Pie,
A fish can't whistle and neither can I.
Ask me a riddle and I reply
Cottleston Cottleston Cottleston Pie.
-- A. A. Milne
| |
| Richard E Maine 2005-05-27, 4:01 pm |
| In article <1117212099.575832.327450@z14g2000cwz.googlegroups.com>,
"wiggy13" <wiggy13@gmail.com> wrote:
> I would like to know how to > a.out infile return to run and
> not a.out return, then infile return
See <http://www.winteracter.com/f2kcli>
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
| |
| wiggy13 2005-05-27, 4:01 pm |
| anything for linux?
| |
| Rich Townsend 2005-05-27, 4:01 pm |
| wiggy13 wrote:
> anything for linux?
>
f2kcli works with Linux. Alternatively, try "man getarg".
cheers,
Rich
| |
| Richard E Maine 2005-05-27, 4:01 pm |
| In article <1117216007.924749.68480@g47g2000cwa.googlegroups.com>,
"wiggy13" <wiggy13@gmail.com> wrote:
> anything for linux?
Did you actually go check the reference I gave? The reason I was so
brief in my reply was
1. That site really has everything that you need to know on the subject,
including even mentions of other approaches. Anything I could say would
be just redundant. One of the nice things about the site is that it
saves me a lot of typing.
In particular, the site has information about options for almost every
operating system currently in widespread use (and some that aren't very
widespread at all). It certainly has plenty of information about Linux
options.
2. I assumed from your first post that you probably were not a native
English speaker and thus that it might help for me to be as brief and
simple as possible.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
| |
| wiggy13 2005-05-27, 8:57 pm |
| let me look at it.
You see the problem is that if I type a.out then return
filein then return
I got output
however if I type a.out < infile and enter I got problem
........................................................................................
open: No such file or directory
apparent state: unit 10 named "Record Length" 2500 "Points"
-8.80000012e-009 0.0001414063
lately reading sequential formatted external IO
Abort (core dumped)
///////////////////////////////////////////////////////////////////////////////////////////
program t
c
c Author: jason
c
c
c implicit NONE
c
c constants
CHARACTER(LEN=5) :: name,gna,nama2
integer max_s
parameter (max_s = 10000) ! same as in driver prog
c arguments and common blocks
integer npar,iflag
* double precision futil, chi2, par(*), grad(*)
real sum,sy
integer num_points
real x(max_s), y(max_s), dy(max_s), zd(max_s)
common / data_block / num_points, zd, x, y, dy
c local variables
character*80 infile
character*80 line
integer i
integer ios
integer lun,luo
double precision alpha
character*80 outfile1 /'out1.dat'/
character*80 outfile2 /'out2.dat'/
c beginccccccccccccccccccccccccccccccccccc
cccccccccccccccccccc
c write (*, *) 'enter file name for input data'
read (*, '(a80)') infile
lun = 10
open (unit=lun, file=infile,form='formatted',ACCESS='DIR
ECT',
+ status='old')
cccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccc
i = 0
ios = 0
do while ( ios .eq. 0 )
read (lun, fmt = '(a80)', iostat = ios) line
if (ios .eq. 0 .and.line(1:1) .ne. '"') then
i = i + 1
read (line, *) x(i),y(i)
endif
c endif
end do
close (lun)
cccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccc
do i = 1,125
sy = sy + y(i)
enddo
sy =sy/125.
sum = 0.
do i = 441,900
if (y(i).le.sy) then !This is obtain from doing part c below
sum = sum+.5*abs((y(i)-sy)+(y(i+1)-sy))*(x(i+1)-x(i))
sumi = sumi+.5*abs((y(i)-sy)+(y(i+1)-sy))*((i+1)-(i))
endif
enddo
cccccccccccccccccccccccccccccccccccccccc
ccccccccccc
write(*,*) 'Record Length= ',zd(1),' Points'
write(*,*) 'Sample Interval= ',zd(2),' s'
write(*,*) 'Trigger Point= ',zd(3),'Samples'
write(*,*) 'Trigger Time= ',zd(4), ' s'
write(*,*) 'Horizontial Offset= ',zd(6), 's'
write(*,*) '--------------------------'
write(*,*) 'ave at far y',sy/125.
write(*,*) 'final sum',sum
write(*,*) '1',x(1),y(1)
write(*,*) '7',x(7),y(7)
write(*,*) '8',x(8),y(8)
END
****************************************
***********************
| |
| Steven G. Kargl 2005-05-28, 3:58 am |
| In article <1117235333.201538.254820@g43g2000cwa.googlegroups.com>,
"wiggy13" <wiggy13@gmail.com> writes:
>
> however if I type a.out < infile and enter I got problem
You are using file redirection on the command line. The
first line of infile needs to please
> read (*, '(a80)') infile
this read statement, so that
> lun = 10
> open (unit=lun, file=infile,form='formatted',ACCESS='DIR
ECT',
> + status='old')
this open statement works.
Does your infile match these expectations?
--
Steve
http://troutmask.apl.washington.edu/~kargl/
| |
| wiggy13 2005-05-28, 3:58 am |
| There is a reason to this. I got many files that need to be read as
inputs.
a.out < infile would do the job without modifiy the source code.
| |
| John Doe 2005-05-28, 3:58 am |
| wiggy13 wrote:
>There is a reason to this. I got many files that need to be read as
>inputs.
>
>a.out < infile would do the job without modifiy the source code.
>
>
>
echo infile | ./a.out
| |
| Paul Van Delst 2005-05-28, 3:58 am |
| wiggy13 wrote:
> There is a reason to this. I got many files that need to be read as
> inputs.
>
> a.out < infile would do the job without modifiy the source code.
>
Maybe this is just a misunderstanding about what "infile" is?
Forgive me if you already know this but
a.out < infile
does *not* translate to
"open a file called 'infile' in my program"
What it means is to take the _contents_ of the file called "infile" and pass that to the
Fortran program.
Let's say you want to process a file called "mydata.dat". Then you would create your
"infile" like so (or variants thereof):
unix: echo mydata.dat > infile
unix: cat infile
mydata.dat
unix: a.out < infile
This will then pass the string "mydata.dat" to your program's READ statement.
Like I said, if you already knew this: apologies.
cheers,
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
| |
| wiggy13 2005-05-28, 3:58 am |
| Thanks alot.! I everyone. did not know that. I'm just a novice.
| |
| Boo, hoo! 2005-05-28, 3:58 am |
|
"Rich Townsend" <rhdt@barVOIDtol.udel.edu> wrote in message
news:d77kmq$onb$1@scrotar.nss.udel.edu...
Dickhead, this is not the forum for your regressions.
Get professional help: whips, paddles, aunt Polly, pills (lots of
nonprofessional advise on c.l.f in this matter, c.l.f. being so
intellectually bankrupt as to proffer in a pinch unlicensed medical
practice which logically begs the question as to the validity of its
doyens' opinion on matters Fortran or otherwise.) Have a great recovery,
flowers, kissy kiss, etcetera, etcetera, etcetera. And a big wet one to
your pooch. :-).
--
You're Welcome,
Gerry T.
______
"The best lesson life has taught me is that the idiots in many cases are
right." -- Churchill.
|
|
|
|
|