LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ini_WriteToFile function can not support a cihinese directionary. why? bug?

Hello;
   I have met a problem when I use ini_writetofile in cvi 8.0. That's it doesn't  work  if  the  ini  file  is in  a  chinese  path.
   And  even  the  ini file   exists  int the directionary, The ini_writeToFile will delete it and return an error.
  The function ini_loadFromFile can work OK in same situation. why?
  Thanks.
0 Kudos
Message 1 of 7
(5,431 Views)
  I am sorry to make a mistake in the tiltle. But i can not edit it . I mean in a Chinese path, it can not work well.
0 Kudos
Message 2 of 7
(5,430 Views)
I have no experience on chinese language, but the inifile instrument source code is available so you can examine it and check where and why the error arises.
 
Ini_WriteToFile function is based on the following functions:
- CreateAndOpenTemporaryFile from the Programmer's Toolbox, whose source code is also available (ultimately it uses fopen to open the file)
- A series of fwrite to write elements down to the file
- fclose to close the file, and finally
- DeleteAndRename
 
You can load both IniFile and toolbox as instruments and then attach the source code and execute it line by line to find the line on error.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 7
(5,419 Views)
Thanks!
   I trace into it. And finally, I found  the function RenameFile return a -1 error. It mean file or directionary not found. Can i get its source code?
0 Kudos
Message 4 of 7
(5,416 Views)
Unfortunately RenameFile is part of the utility library and is not distributed at source code level. Smiley Sad
I'm afraid I cannot help anymore in this problem... sorry.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 7
(5,411 Views)
Thanks for your good advise!
 I have solved it. But i am sure it's a bug from NI.
I have tested the function 'RenameFile'  int English path and Chinese path  and found some funny thing:
 If you pass it a absolute path,  it can support both English and Chinese Path.But 
 if you pass it a relative path, it only  support English path. One chinese path will lead to a -1 error.
So I replace the path with absoluate one, the problem is OK now.
 By the way, Ahtough i use cvi not more than half a year. I really found some bugs in it. I think in the ole and multithread  fields, It should be tested more.
I use the cvi8.0, perhaps the version has corrected them.
0 Kudos
Message 6 of 7
(5,391 Views)

i think i know how to solve it.

you should add the instrum file(inifile.fp here) to the project once, not load the instrument only.

 

without adding it, it may works well usually, but may fails loading path name sometimes, which causes the target file deleted. 

0 Kudos
Message 7 of 7
(4,980 Views)