0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C++ builder > exception > UnicodeString??? Date ????? > VarToDateTime 関連のエラーのようだ

Last updated at Posted at 2016-02-22
動作確認
C++ Builder XE4

連続動作14日目にエラーが出た。

エラーメッセージは以下だった。動作OSが英語版なので例外メッセージも英語化しておかないといけないのか。

exception > UnicodeString??? Date ?????

とりあえず検索したら以下を見つけた。

I changed my code and put the '02 August 2012 18:53' into AnsiString Variable, but now I have this error : 'could not convert variant of type (String) into type (Date)

...

VarToDateTime leads to a path that 'VarDateFromStr' is called with LOCALE_USER_DEFAULT. If the user locale is not US (or compatible), a type mismatch occurs.

英語OS用に使用したVarToDateTime()にて上記の問題があるとのこと。

しかし上記エラーが毎回発生せず、10日から20日に1回程度しか起こらないので、また別の問題かもしれない。

関連している処理としては GPS から日時を受信し、それをTDateTime型に変換して使っている。そのあたりのtry, catch対策をするか、受信文字列のチェック機構を入れるなどの対策が必要なのだろう。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?