source: trunk/examples/showdata/showdata.f @ 5348

Last change on this file since 5348 was 2529, checked in by dkearney, 13 years ago

updating the fortran showdata example and the c++ getFile and fortran's
rp_lib_get_file functions to correctly return the number of bytes written to
the file.

File size: 943 bytes
Line 
1      program showdata
2        IMPLICIT NONE
3
4        integer rp_lib, rp_lib_get_file
5        integer driver, nbytes
6        CHARACTER*100 inFile, strVal
7
8        call getarg(1,inFile)
9        driver = rp_lib(inFile)
10        if (driver .eq. 0) then
11            write(0,*) "Error while opening ",inFile
12            stop
13        endif
14
15        nbytes = rp_lib_get_file(driver,
16     +        "input.string(data).current", "mydata.dat")
17        if (nbytes .le. 0) then
18            write(strVal,*) "Error while writing data file"
19            write(0,*) strVal
20            call rp_lib_put_str (driver,"output.log",strVal,0)
21            call rp_result(driver)
22            stop
23        endif
24
25        OPEN (UNIT=5, FILE="mydata.dat", STATUS="OLD")
26
27        call rp_lib_put_file (driver,"output.string(data).current",
28     +          "mydata.dat",0,0)
29
30        CLOSE (UNIT=5, STATUS="DELETE")
31
32        call rp_result(driver)
33      end program showdata
Note: See TracBrowser for help on using the repository browser.