問題タブ [ptree]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
26 参照

c++ - Boost's read_ini throws exception "'=' character not found in line" but file structure is correct

I have the following throwing an exception that is logged as:

Failed to read in "Configuration File.ini". Exception: Configuration File.ini(1): '=' character not found in line

However, the structure of the file is correct.

The code:

The curious thing is that the ini file is generated/modified by a different application and after the change does the exception get thrown. Yet, if I copy the exact contents of the ini file to a new file and rename it to "Configuration File.ini," there are no problems.

To specify, the other application closes the stream to the file upon completion, and even if the other application is not running, once the file has been modified by the other application at any point in time (i.e. even after reboot), this exception gets thrown.

Here are some of the things attempted and observations:

  • The issue does not seem to be with the contents of the file itself, since if I copy the contents of a "bad" file (i.e. one that throws the exception) into a different file, then the exception is NOT thrown
  • If I create a copy of the "bad" file, that copy will also throw an exception
  • If I make a copy of a "good" file, that copy will NOT throw an exception
  • Have tried so that the absolute path is provided to the file (i.e. instead of "Configuration File.ini" to "C:\Program Files (x86)\Exe Location\Configuration File.ini" - it does not make a difference. The same things are observed.
  • Have modified so that file contains only one setting in one section in a "bad" file, same exception gets thrown
    • If I make the same content changes within a "good" file, the exception does not get thrown
  • If the original ini is deleted by the other application, then created, the same exception gets thrown.

Thus, I am drawing the conclusion that it has something to do with the fact that "bad" files are those that have previously been edited/created by a different application, and no matter the content of the file itself, the same exception gets thrown. But, I cannot understand why.

Any thoughts/ideas?