C
Confessor
[Ellipses added to defeat word wrapping, improve readability]
Public Class Form1
Inherits System.Windows.Forms.Form
Structure PointTemplate
Dim Latitude As Single
Dim Longitude As Single
Dim Elevation As Integer
End Structure
Dim MaxPoint As Integer
Dim Point() As PointTemplate
[Windows Form Designer Generated Code]
Private Sub Form1_Load(...) Handles MyBase.Load
If System.IO.File.Exists("C:\...\points.dat") = True Then
System.IO.File.OpenRead("C:\...\points.dat")
Else
System.IO.File.Create("...\points.dat")
End If
End Sub
End Class
I'm hoping to store a persistent collection of points on the Earth's
surface (defined by Lat, Long, and Elevation), reading the data from and
writing to a file. Points read from the file will be stored in the Point()
array.
The best logical way to read data from the file into the array would seem
to be as follows, if you can forgive my lack of proper understanding of
file access commands.
For T = 1 to MaxPoint
Read [line beginning with T] into Point(T).[variables]
Next
MaxPoint would of course, be stored in the file as well, probably at the
beginning.
Am I missing only exact syntax, or is my understanding of file access in
need of a paradigm shift?
Any help with either would be appreciated.
Thanks to everybody in advance,
Confessor
Public Class Form1
Inherits System.Windows.Forms.Form
Structure PointTemplate
Dim Latitude As Single
Dim Longitude As Single
Dim Elevation As Integer
End Structure
Dim MaxPoint As Integer
Dim Point() As PointTemplate
[Windows Form Designer Generated Code]
Private Sub Form1_Load(...) Handles MyBase.Load
If System.IO.File.Exists("C:\...\points.dat") = True Then
System.IO.File.OpenRead("C:\...\points.dat")
Else
System.IO.File.Create("...\points.dat")
End If
End Sub
End Class
I'm hoping to store a persistent collection of points on the Earth's
surface (defined by Lat, Long, and Elevation), reading the data from and
writing to a file. Points read from the file will be stored in the Point()
array.
The best logical way to read data from the file into the array would seem
to be as follows, if you can forgive my lack of proper understanding of
file access commands.
For T = 1 to MaxPoint
Read [line beginning with T] into Point(T).[variables]
Next
MaxPoint would of course, be stored in the file as well, probably at the
beginning.
Am I missing only exact syntax, or is my understanding of file access in
need of a paradigm shift?
Any help with either would be appreciated.
Thanks to everybody in advance,
Confessor