Please let me express my sincere thanks for all the input! You all have
been a great help.
-Phil
]
>
>Phil -
>
> > (hopefully) my file pointer stays put.
>
>Oh well! Bob and Les are right. When VEE reopens the file it starts from
>square one. You can see the same behavior if you open your file more than
>once in your dll.
>
>Anyway, I can see a couple ways around this. First, return your file
>pointer
>to VEE and have VEE seek to that location. How? Read the file as an array
>of
>UInt8 (to end) and then do something like:
>
>asText(ary[<filepointer>:totSize(ary) - 1])
>
>Now, I have no idea if this will work because I don't have version 6, but
>it
>seems as if it should work.
>
>Second, read the file as a text array (to end) and just use strPosStr to
>search for your keyword. Run the output through a Comparator set to == -1
>and the X Data of the Failures pin identifies the array subscript at which
>your keyword is found. Then just copy from the next element to the end (see
>attached).
>
>Your desire to write loopless VEE is admirable!
>
>BUT: The VEE way with a comparator is almost certainly *much* faster than
>looping with fgets! WHY?? There are two reasons:
>
>First, I/O is *really* slow, and the buffers allocated by the old C RTL
>routines are not very big (like 4K if memory serves) so you're going to hit
>the disk a lot. Window's automatic cacheing will help, but how much is
>debatable.
>
>Second, fgets is an old C RTL routine. Like it or not, it's just not kosh
>with Windows. You can drastically improve performance by using the Windows
>Way with CreateFile / ReadFile / CloseHandle and using Stupid C Tricks to
>do
>your own searching - something like the attached.
>-SHAWN-
><< ArySearch.vee >>
><< SearchFile.txt >>
>---
>You are currently subscribed to vrf as: philmcrevis@hotmail.com
>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
>To send messages to this mailing list, email
>"vrf@it.lists.it.agilent.com".
>If you need help with the mailing list send a message to
>"owner-vrf@it.lists.it.agilent.com".
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
been a great help.
-Phil
]
>
>Phil -
>
> > (hopefully) my file pointer stays put.
>
>Oh well! Bob and Les are right. When VEE reopens the file it starts from
>square one. You can see the same behavior if you open your file more than
>once in your dll.
>
>Anyway, I can see a couple ways around this. First, return your file
>pointer
>to VEE and have VEE seek to that location. How? Read the file as an array
>of
>UInt8 (to end) and then do something like:
>
>asText(ary[<filepointer>:totSize(ary) - 1])
>
>Now, I have no idea if this will work because I don't have version 6, but
>it
>seems as if it should work.
>
>Second, read the file as a text array (to end) and just use strPosStr to
>search for your keyword. Run the output through a Comparator set to == -1
>and the X Data of the Failures pin identifies the array subscript at which
>your keyword is found. Then just copy from the next element to the end (see
>attached).
>
>Your desire to write loopless VEE is admirable!
>
>BUT: The VEE way with a comparator is almost certainly *much* faster than
>looping with fgets! WHY?? There are two reasons:
>
>First, I/O is *really* slow, and the buffers allocated by the old C RTL
>routines are not very big (like 4K if memory serves) so you're going to hit
>the disk a lot. Window's automatic cacheing will help, but how much is
>debatable.
>
>Second, fgets is an old C RTL routine. Like it or not, it's just not kosh
>with Windows. You can drastically improve performance by using the Windows
>Way with CreateFile / ReadFile / CloseHandle and using Stupid C Tricks to
>do
>your own searching - something like the attached.
>-SHAWN-
><< ArySearch.vee >>
><< SearchFile.txt >>
>---
>You are currently subscribed to vrf as: philmcrevis@hotmail.com
>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
>To send messages to this mailing list, email
>"vrf@it.lists.it.agilent.com".
>If you need help with the mailing list send a message to
>"owner-vrf@it.lists.it.agilent.com".
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
What is happening is that the DLL (acting as the independent program that it
is) opens the file and has all the file pointer information in its own
memory. In Microsoft C and C++ it is in the structure type definition FILE.
The fopen function uses the structure for such things file attributes as
disk, track, sector, record, byte offset, read pointer, write pointer, file
start, file stop, etc.
When you open the same file in VEE, the same thing occurs, HOWEVER(!!), VEE
has a different block of memory for its local storage of all the same file
attributes. The result is TWO DIFFERENT programs are now trying to access
the same file. For reading only, you can get away with it. If either
program does any writing, the results can be catastrophic. Remember the
lost fragments that ScanDisk finds?
To answer your question, I do not know of any way for a DLL and VEE to share
the same block of memory. VEE does not give access to it. As a suggestion
that will make the VEE program still run faster than not having the DLL
would be to do this: have the DLL do its thing, return a record count, close
the file, and then return. Then, VEE can open the file, read that many
records without bothering to do any searching for the keyword, and then
continue as originally written.
Robert Reavis
Warm Springs Computer Works
Fremont, California
----- Original Message -----
From: "Phil McRevis" <philmcrevis@hotmail.com>
To: "VEE vrf" <vrf@it.lists.it.agilent.com>
Sent: Tuesday, August 20, 2002 11:01 AM
Subject: [vrf] File Pointer DLL Modification
> Hi everyone,
>
> I am a little perplexed at some behavior in VEE, but I'm still willing to
> accept the fact that it is my ignorance causing the problems.
>
> I wrote a DLL in C which uses fopen() to open a file. The 2 parameters
> passed into this DLL are char* and they specify the filename as well as a
> keyword to search for in this file.
>
> After a successful fopen() I use fgets() to search for my keyword
> line-by-line (looping in VEE was simply out of the question which is why
I'm
> doing it in compiled code).
>
> When the keyword is found I exit the DLL without calling fclose() so that
> (hopefully) my file pointer stays put.
>
> Then in VEE I immediately use a FromFile object to perform a
> "READ TEXT x STR ARRAY:*" to get everything from the file pointer location
> and beyond.
>
> Unfortunately this returns ALL of the data from the file as if my file
> pointer is being reset when the DLL exits OR when From File starts.
>
> any ideas?
>
> -Phil
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> ---
> You are currently subscribed to vrf as: robert@wscw.com
> To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
> To send messages to this mailing list, email
"vrf@it.lists.it.agilent.com".
> If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".