Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read binary file and copy to two arrays

Status
Not open for further replies.

thepunisher

Programmer
Jul 23, 2004
108
IE
Hi,

I want to read in two binary files, then save the contents to two arrays, how do i do this?

I am converting fortran code to vb6, so i am not really sure what im doing, so any VB code that saves binary file data to arrays is welcome.

Thanks,

thePunisher

PS- Below is my code so far....

'input files :

'open (unit=5, access="sequential", carriagecontrol="list", '+form='formatted', organization='sequential', readonly,
'+status="old")
'
Open "C:\David McGarry\Week14\20 September 2004\Modloads\DAVE.BIN" For Append As #1

'open (unit=21, access='direct', form='unformatted',
'+maxrec=375, organization="sequential", readonly, recl=64, 'DO AN OPEN
'+recordtype="fixed", status="old")

'output Files:
'I want to open two output files....
'open (unit=6, access="sequential", carriagecontrol="list", '+form='formatted', organization='sequential',
'+status="replace")
'
'open (unit=22, access='direct', form='unformatted',
'+maxrec=375, organization="sequential", recl=64, recordtype="fixed",
'+status="replace")

'write blank line at the start:
Open "C:\David McGarry\Week14\20 September 2004\Modloads\report.txt" For Append As #2
L49:
'format ()
For INDEX1 = 1 To DAYS_PER_YEAR '1 to 365.
' read (unit=21, rec=index1) nrec, date, month, year,
' + (load(hhour),hhour=1,loads_per_day), dayno, weekno, period,
' + kode, isys, (fill_out(index2),index2=1,7)
For INDEX2 = 1 To LOADS_PER_DAY 'There are 48 loads per day.
LOADARRAY1(INDEX1, INDEX2) = LOAD(INDEX2)
LOADARRAY2(INDEX1, INDEX2) = LOAD(INDEX2)
Next
Next
'Close #1: Exit Sub
Close #1: Exit Sub
Close #2 'Close the file.

MsgBox ("Initialised")


The Wolf: Thats 30 minutes away. I'll be there in 10.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top