MikaelH Posted January 6, 2010 Report Share Posted January 6, 2010 Hi We have experienced some strange things on some computers running the a LV executable applications. We download ini-file content from a database and temporary write them to an ini-file so we can use the Configuration File VIs. 1) We delete the file (it might already exist) 2) We write a new file 3) We open it with the “Open Config Data” VI. So easy, but we have experienced problems on some computers running this code in an LV executable. It always works when running it from the Dev Environment. (FYI the VI that create this Config data Refnum is not reentrant) The problem is that the file is empty. Why I see an empty file is probably because I use the Default input to the “Open Config Data” VI, that lets it Create the file if it doesn’t exist. But why is it not created. Any ideas? Is Window treating files in the Temporary folder different? Are commands (e.g. the Delete File), somehow cashed in Windows and executed later when the file is in the temporary folder? We have solved it by doing this for now, but why why why???? Cheers and happy New Year guys. Mikael Quote Link to comment
jdunham Posted January 7, 2010 Report Share Posted January 7, 2010 Is Window treating files in the Temporary folder different? Are commands (e.g. the Delete File), somehow cashed in Windows and executed later when the file is in the temporary folder? Hi Mikael: Even though your non-working code is probably trivial, maybe you should post a snapshot of that too. We do the same operation and haven't seen a problem in built exes. You mentioned it only happens on some computers. Is there a difference between XP and Vista/Win7? Quote Link to comment
MikaelH Posted January 7, 2010 Author Report Share Posted January 7, 2010 Hi We're running XP, and most of them are XP embedded. We started to notice this problem when we updated the code to be LV 2009 compatible. The funtion takes a string in and returns a Configuration Ref Num, in LV 2009, this is replaced by a class. So in the initial design we used the "Private" functions in the Config VIs to create the object, but in LV 2009 this is not possible since we can use the private VIs any more. This is the initial code, which always has been working: And here is the code we changed to and started generating problems. LcString_OpenConfigDataUsingString.vi This problem has become more and more frequent for some reason, before is occurred about 0-2 times a week, but latelty we saw it several times a day. Maybe it's the virus protection application that causes the problem. Cheers, Mikael Quote Link to comment
EricLarsen Posted January 7, 2010 Report Share Posted January 7, 2010 After calling Write File, have you tried calling Flush File? If it's some kind of file buffering issue, that might help. Quote Link to comment
crelf Posted January 7, 2010 Report Share Posted January 7, 2010 And here is the code we changed to and started generating problems. I'm not so sure what you're trying to do here - you delete the file if it's there (have you though of using the OpenG "File Exists?" before trying to delete it?), then you write some text into the file, then you try to open it using the Config Open. Yeah, I'd say there's a fludhing issue. Also, unless the initial text is formatted correctly, it's not going to be interpreted properly by subsequent Config File Reads... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.