Code Comments
Programming Forum and web based access to our favorite programming groups.I would like to know how to > a.out infile return to run and not a.out return, then infile return
Post Follow-up to this messagewiggy13 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
Post Follow-up to this messageIn 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
Post Follow-up to this messagewiggy13 wrote: > anything for linux? > f2kcli works with Linux. Alternatively, try "man getarg". cheers, Rich
Post Follow-up to this messageIn 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
Post Follow-up to this messagelet 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 **************************************** ***********************
Post Follow-up to this messageIn 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/
Post Follow-up to this messageThere 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.
Post Follow-up to this messagewiggy13 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.