Re: UDT question
- From: "Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.com>
- Date: Mon, 23 May 2005 16:26:05 -0500
hi mike,
i should note that the source file containing the datalistings is already on
disk. it is this file that is read into the structure.
lance
"Mike D Sutton" <EDais@xxxxxxxx> wrote in message
news:uZ%23cWx9XFHA.3620@xxxxxxxxxxxxxxxxxxxxxxx
>> i've got a UDT structured as such
> <code snipped>
>> with a datalisting entry (read from a text file) as follows
>>
>> 05/21/2005 13:36:00 CDT 1.39 1.46
>> 0.07 -999 -999 -999 -999.9 -99.9 -99.9
>>
>> the problem (inconvenience, really) is that i've got many, many
>> calculations
>> to perform with these value within the structure (and the are hundreds of
>> datalistings). basically, for each calculation, i'm currently using
>> datatype conversions (ie., Csng, Cdbl, Cdate, etc.) and it's starting to
>> get
>> pretty ugly. is there a more efficient way to breakdown the datalisting?
>> ideally, it would be
> <code snipped>
>> so calculations could be perform without converting them from strings,
>> but
>> the only way i can think of to do this is to restructure the datalisting
>> into the structure above. is that basically what i'm going to have to do
>> or
>> am i completely overlooking an easier way?
>
> Open the file in Binary mode and you can read and write this structure
> type directly.
>
> '*** Warning; air-code..
> Dim FNum As Integer
> Dim MyStruct As DataListing
>
> ' Populate MyStruct here..
>
> FNum = FreeFile() ' Write structure to disk
> Open FileName For Binary Access Write Lock Read Write As #FNum
> Put #FNum, , DataListing
> Close #FNum
>
> FNum = FreeFile() ' Read structure from disk
> Open FileName For Binary Access Read Lock Write As #FNum
> Get #FNum, , DataListing
> Close #FNum
> '***
>
> You'll also find that in most cases this makes the files you're working
> with a lot smaller and since they're just raw
> binary data a lot more difficult to tamper with for 'average' users.
> Hope this helps,
>
> Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: EDais@xxxxxxxx
> WWW: Http://EDais.mvps.org/
>
>
.
- Follow-Ups:
- Re: UDT question
- From: Mike D Sutton
- Re: UDT question
- References:
- UDT question
- From: Lance
- Re: UDT question
- From: Mike D Sutton
- UDT question
- Prev by Date: Re: UDT question
- Next by Date: Re: Installing Fonts
- Previous by thread: Re: UDT question
- Next by thread: Re: UDT question
- Index(es):
Relevant Pages
|