Software Archive
Read-only legacy content
17061 Discussions

Several questions about I/O

Deleted_U_Intel
Employee
524 Views
I have several questions about I/O that may or may not be related but any help would be appreciated.

I made a fortran dll that I want to use in VB How do I send the location and name of the at file to the dll? Can I send it the path name as a variable (assuming the at file is in a different location that the dll)?

Can I assign UNIT numbers to different locations (yes, I know there are default unit numbers)? Where do I do that?

Suppose I made a different dll that reads and writes to an Access data base, how do I do that? Specifically, do I use OPEN statements? What would the UNIT number be? If I want certain read statements to be assocaited with certain locations in the database (ie: rec=14), how will I know what the record numbers are associated to which record? Now, when they say record number, is that refering to a cell? a sheet? a database? And, if the data base is in a different location than the dll, how do I tell the dll where to find the database?

And lastly, if you could point me in the direction of some good (helpful) books regarding these more complex questions, I would greatly appreciate it.

Thanks.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
524 Views
You can specify the path to a file by using an OPEN statement, for example:


OPEN (UNIT=3.FILE="D:MYPATHFILE.DAT",FORM="FORMATTED")


The unit number can be any non-negative integer you want, though I suggest avoiding 0, 5 and 6.


You can pass a file name as a character argument from VB to VF, though you have to specify that is passed "by val". See the mixed-language chapter of the Visual Fortran Programmer's guide for more details.


Fortran direct access files are not the same as a spreadsheet or MS Access database - they are a series of fixed-length records addressed by record number (starting with 1). You determine what the association is.


If you want to read Excel or Access files, I suggest looking at Canaima Software's f90SQL library.


I would suggest looking through the Programmer's Guide - you can buy a printed copy if you prefer. It also sounds as if you could use some "brushing up" on the Fortran language. One of the books I like best is "Fortran 90/95 for Scientists and Engineers" by Stephen Chapman. You can get it from your favorite bookseller or through the Compaq Fortran Online Bookstore.


Steve

0 Kudos
Reply