gpt4 book ai didi

c - DLL 未从 LabVIEW 写入 txt 文件?

转载 作者:行者123 更新时间:2023-11-30 20:38:09 33 4
gpt4 key购买 nike

我在labview中调用一个dll,其中dll获取两个数字进行求和,然后必须将其保存在txt文件中。求和工作完全正常,但将其写入 txt 中却不起作用。当我创建单独的 c 项目并使用相同的代码在 txt 中保存一些随机数时,它就可以工作。诀窍在哪里?

动态链接库:

#include<stdio.h>
FILE *ptr_file;
int __declspec(dllexport) ArrayFind(int a, int b, int* c);

int __declspec(dllexport) ArrayFind(int a, int b, int* c)
{
*c = a + b;
ptr_file = fopen("C:\\FILE.txt", "w");
fprintf(ptr_file, "%d\n", c);
fclose(ptr_file);

return;
}

最佳答案

为什么需要使用DLL来获取数字?

LabVIEW 可以轻松地从各种硬件读取值、执行求和并写入文件,所有这些都使用其 native 函数。

您是否想了解如何从 LabVIEW 调用 DLL?

关于c - DLL 未从 LabVIEW 写入 txt 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30378695/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com