发 帖  
原厂入驻New
申请华秋企业认证 多层板首单免费打样!
30s提交资料,10分钟通过审核(免费赔付+顺丰包邮)>>立即报名
[问答] 文件指针DLL怎么修改?
89 dll
分享
请允许我对所有的意见表示衷心的感谢!
你们都得到了很大的帮助。-Phil] >> Phil - >>>(希望)我的文件指针保持不变。>>哦,好吧!
鲍勃和莱斯是对的。
当VEE重新打开文件时,它从> 1开始。
如果你在dll中打开文件超过一次,你可以看到相同的行为。>>无论如何,我可以看到几个方法。
首先,将文件>指针>返回给VEE,让VEE寻找该位置。
怎么样?
将文件读取为> UInt8的数组>(结束),然后执行以下操作:>> asText(ary [:totSize(ary) - 1])>>现在,我不知道这是否有效,因为我不知道
没有版本6,但是>它似乎应该可以工作。>>其次,将文件作为文本数组读取(结束)并使用strPosStr>搜索您的关键字。
通过设置为== -1>的Comparator运行输出,并且Failures引脚的X Data标识找到>您的关键字的数组下标。
然后只需从下一个元素复制到结尾(参见>附件)。>>你想要编写无环VEE的愿望令人钦佩!>>但是:使用比较器的VEE方式几乎肯定比用fgets循环快*快*!
为什么??
有两个原因:>>首先,I / O真的*非常慢,并且旧的C RTL>例程分配的缓冲区不是很大(如果内存服务就像4K一样)所以你要打>磁盘
很多。
Window的自动缓存会有所帮助,但多少是有争议的。>>其次,fgets是一个旧的C RTL例程。
无论喜欢与否,它与Windows不同。
你可以通过使用Windows> Way with CreateFile / ReadFile / CloseHandle并使用Stupid C技巧来做>你自己的搜索 - 就像附带的那样,大大提高性能。> - SHAWN - >>>>> --->
0
2019-11-6 10:47:21   评论 分享淘帖 邀请回答
3个回答
“无知”一词相当苛刻,让我们称之为一个小的疏忽。发生的事情是DLL(作为itis的独立程序)打开文件并在其自己的内存中包含所有文件指针信息。
在Microsoft C和C ++中,它在结构类型定义FILE中.fopen函数使用结构来处理文件属性,如磁盘,轨道,扇区,记录,字节偏移,读指针,写指针,文件启动,文件停止等。
你在VEE中打开相同的文件,同样的事情发生,HOWEVER(!!),VEE有一个不同的内存块,用于本地存储所有相同的文件属性。
结果是两个不同的程序现在正在尝试访问同一个文件。
只读,你可以逃脱它。
如果任何一个程序做任何写作,结果可能是灾难性的。
还记得ScanDisk找到的丢失的片段吗?要回答你的问题,我不知道DLL和VEE有什么办法共享同一块内存。
VEE无法访问它。
作为一个建议,这将使VEE程序仍然运行得比没有DLL这样做更快:让DLL做它的事情,返回记录计数,关闭文件,然后返回。
然后,VEE可以打开文件,阅读那么多记录而不必费心去搜索关键字,然后继续按原来写的.Robert ReavisWarm Springs Computer Works加利福尼亚州弗里蒙特-----原始消息-----来自:“Phil
McRevis“To:”VEE vrf“发送时间:2002年8月20日星期二11:01 AMS主题:[vrf]文件指针DLL修改>大家好,>>我对VEE中的某些行为感到有些困惑,但我仍然
愿意>接受这是我无知导致问题的事实。>>我在C中写了一个DLL,它使用fopen()打开一个文件。
传入此DLL的2个参数>是char *,它们指定文件名以及要在此文件中搜索的>关键字。>>成功fopen()后,我使用fgets()搜索我的关键字> line-
by-line(在VEE中循环简直是不可能的,这就是为什么我在编译代码中执行它。)>>当找到关键字时我退出DLL而不调用fclose()以便>(希望)我的文件
指针保持放置。>>然后在VEE中我立即使用FromFile对象执行>“READ TEXT x STR ARRAY:*”从文件指针位置>以及更远的地方获取所有内容。>>不幸的是,这将返回来自的所有数据
该文件好像我的文件>指针在DLL退出时或者从文件启动时被重置。>>任何想法?>> -Phil >> _________________________________________________________________>在您的移动设备上发送和接收Hotmail:http://mobile.msn
.com >>> --->您目前订阅了vrf:robert@wscw.com>要取消订阅,请发送空白电子邮件至“leave-vrf@it.lists.it.ag
ilent.com“。>要发送邮件到这个邮件列表,请发送电子邮件至”vrf@it.lists.it.agilent.com“。>如果您需要有关邮件列表的帮助,请发送邮件至”owner-vrf@it.lists
.it.agilent.com“.---您目前订阅了vrf:rsb@soco.agilent.com要取消订阅,请发送空白电子邮件至”leave-vrf@it.lists.it.agilent.com“。发送
发送到此邮件列表的邮件,请发送电子邮件至“vrf@it.lists.it.agilent.com”。
如果您需要有关邮件列表的帮助,请发送邮件至“owner-vrf@it.lists.it.agilent.com”。

以上来自于谷歌翻译


     以下为原文

  The term "ignorance" is rather harsh, lets just call it a minor oversight.

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"
To: "VEE vrf"
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".
2019-11-6 10:58:27 评论

举报

>我在C中编写了一个DLL,它使用fopen()打开一个文件。
传入此DLL的2个参数>是char *,它们指定文件名以及要在此文件中搜索的>关键字。> ...>当找到关键字时,我退出DLL而不调用fclose(),这样
>(希望)我的文件指针保持不变。>我不认为这是真的。
当分配它的DLL退出时,指针将丢失。>任何想法?为什么不从DLL返回所需的数据?
也就是说,让DLL处理整个文件I / O.Les HammerComplete Test720 14th St. SWLoveland,Colorado 80537(970)-663-0006Les.Hammer@CompleteTest.comwww.completetest.com ---您目前订阅了vrf as
:rsb@soco.agilent.com要取消订阅,请发送一封空白电子邮件至“leave-vrf@it.lists.it.agilent.com”。要向此邮件列表发送邮件,请发送电子邮件至“vrf@it.lists.it.agilent。
COM”。
如果您需要有关邮件列表的帮助,请发送邮件至“owner-vrf@it.lists.it.agilent.com”。

以上来自于谷歌翻译


     以下为原文

  > 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.
> ...
> When the keyword is found I exit the DLL without calling fclose() so that
> (hopefully) my file pointer stays put.
>

I don't think that's true.  The pointer will be lost when the DLL that
allocated it exits.

> any ideas?

Why not just return the desired data from the DLL?  That is, let the DLL
handle the entire file I/O.

Les Hammer
Complete Test
720 14th St. SW
Loveland, Colorado 80537
(970)-663-0006
Les.Hammer@CompleteTest.com
www.completetest.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".
2019-11-6 11:16:00 评论

举报

大家好,我对VEE中的某些行为感到有点困惑,但我仍然愿意接受这样的事实,即我的无知导致了这些问题。我在C中写了一个DLL,它使用fopen()打开一个文件。
通过这个DLL的2个参数是char *,它们指定文件名以及要在此文件中搜索的关键字。在成功fopen()之后,我使用fgets()来搜索我的关键字逐行(在VEE中循环是
简单地说,这就是为什么我在编译代码中运行它的原因)。当找到关键字时,我退出DLL而不调用fclose()以便(希望)我的文件指针保持不变。然后在VEE中我立即使用FromFile
对象执行“READ TEXT x STR ARRAY:*”以从文件指针位置获取所有内容。不幸的是,这将返回文件中的所有数据,就好像我的文件指针在DLL退出或From File启动时被重置一样。
任何想法?-Phil _________________________________________________________________在您的移动设备上发送和接收Hotmail:http://mobile.msn.com---您目前订阅了vrf:rsb@soco.agilent.com要取消订阅,请发送空白电子邮件至“leave-vrf”
@ it.lists.it.agilent.com“。发送邮件给这个maili
ng list,发送电子邮件至“vrf@it.lists.it.agilent.com”。
如果您需要有关邮件列表的帮助,请发送邮件至“owner-vrf@it.lists.it.agilent.com”。

以上来自于谷歌翻译


     以下为原文

  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: 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".
2019-11-6 11:31:26 评论

举报

只有小组成员才能发言,加入小组>>

92个成员聚集在这个小组

加入小组

创建小组步骤

关闭

站长推荐 上一条 /5 下一条

快速回复 返回顶部 返回列表