取消
显示结果 
搜索替代 
您的意思是: 

local variables for refnum

I've tried various things but I can seem to write to a file using local variables for refnums.
Help please.
0 项奖励
1 条消息(共 3 条)
3,156 次查看
exo,
 
Try wiring the error output of the 'Open/Create/Replace File' primitive to the 'Write to Text File' primitive.  This will ensure that the file is created before it is written to.  When you use local variables, the risk of race conditions is introduced, which is what is happening here.  There is no problem with passing refnums by local variable, just as long as you make sure that you are reading the variable after its value has been set.  I would suggest only using local variables if absolutely necessary, which is almost never.
 
Also, I suggest wiring a control to the stop terminal of the while loop, instead of a constant.  A constant 'False' value means that the loop will run forever, unless you abort the VI.  Aborting a VI should only be done as a last resort.
 
Chris M
0 项奖励
2 条消息(共 3 条)
3,154 次查看
Thanks.
0 项奖励
3 条消息(共 3 条)
3,144 次查看