LabWindows/CVI 是否有类似于 _setmode() 的功能用于将文件(或流)翻译模式设置为二进制或文本?
我正在使用 gSoap 生成 ANSI C 源代码,我想在 Windows 7 64 位操作系统上的 LabWindows/CVI 环境中构建该源代码。 gSoap 文件 stdsoap2.c 包含 _setmode() 函数的多个实例,其原型如下:
int _setmode (int fd, int mode);
其中 fd 是文件描述符,mode 设置为 _O_TEXT 或 _O_BINARY。
奇怪的是,尽管 LW/CVI 包含 Microsoft SDK 的接口,但该 SDK 在其任何包含的头文件中都不包含 _setmode 的原型,即使 SDK 的帮助链接包含有关该函数的信息。
有谁知道 LabWindows/CVI 中用于将文件(或流)翻译模式设置为文本或二进制的方法。
谢谢, 雷克
I am using gSoap to generate ANSI C source code, that I would like to build within the LabWindows/CVI environment, on a Windows 7, 64 bit OS. The gSoap file stdsoap2.c includes several instances of the _setmode() function, with the following prototype:
int _setmode (int fd, int mode);
Where fd is a file descriptor, and mode is set to either _O_TEXT or _O_BINARY.
Oddly enough, even though LW/CVI contains an interface to Microsoft's SDK, this SDK does not contain a prototype to _setmode in any of its included header files, even though the help link to the SDK contains information on the function.
Is anyone aware of the method in LabWindows/CVI used to set file (or stream) translation mode to text, or binary.
Thanks,
Ryyker
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
结束这个问题的循环。
由于上面评论中列出的原因,我无法使用唯一提供的答案。
虽然我确实使用了 SDK,但并不是选择不同版本的 OpenFile 函数,而是支持使用自动代码生成器使用的函数 _setmode() 但我的主要开发环境 (LabWindows/CVI) 不支持。
因此,总而言之,我的解决方案是包含 SDK 来为我提供 _setmode 的定义,并在我的非自动生成的代码中包含以下内容:
因此,需要注意的是,这篇文章描述了我实际上的内容 em> 做了,我将把 @gary 提供的答案标记为答案,就像在球场上一样。谢谢@加里。
Closing the loop on this question.
I could not use the only offered answer for the reason listed in my comment above.
Although I did use the SDK, it was not to select a different version of the OpenFile function, rather it was to support the use of a function that an auto-code generator used, _setmode() but that was not supported by my primary development environment (LabWindows/CVI).
So, in summary, my solution WAS to include the SDK to give me definition for _setmode as well as including the following in my non- auto-generated code:
So, with the caveat that this post describes what I actually did, I am going to mark the answer @gary offered as the answer, as it was in the ball park. Thanks @gary.
听起来您只想以 ASCII 或二进制形式打开文件。因此,您应该能够将
_setmode()
的实例替换为 LW/CVIOpenFile()
函数,如 此处。这是一个以二进制形式读取文件的简短示例。另请注意页面中的此警告:
It sounds like you just want to open a file as either ASCII or binary. So you should be able to replace the instances of
_setmode()
with the LW/CVIOpenFile()
function as described here. Here's a short example reading a file as binary.Also note this warning from the page: