私のアプリでは、CORBA :: WChar *(または同等のwchar_t *)を使用する必要がありますが、プログラムはPostgreSQLデータベースにいくつかの情報を保存する必要もあります。C ++でPostgreSQLにデータを挿入するには、SOCIを使用します。そして、問題があります:
The following types are currently supported for use with into and use expressions:
char (for character values)
short, int, unsigned long, long long, double (for numeric values)
char*, char[], std::string (for string values)
std::tm (for datetime values)
soci::statement (for nested statements and PL/SQL cursors)
soci::blob (for Binary Large OBjects)
soci::row_id (for row identifiers)
したがって、wchar_t *またはwstringはサポートされていません...そして、CORBA :: WChar(またはwchar_tまたはwchar_t *)を文字列に変換する必要があります。これを行う方法?
CodeBlocks 10.5を使用したワイド文字(および文字列)にも問題があります。
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
const wchar_t *val = L"ąśżźćłóń";
wcout << val << "\n";
return 0;
}
ショー:
E:\Temp\Untitled1.cpp||In function 'int main(int, char**)':|
E:\Temp\Untitled1.cpp|7|error: converting to execution character set: Invalid argument|
||=== Build finished: 1 errors, 0 warnings ===|
それを修正する方法は?
また、UNIX / LinuxとWindowsの両方で実行できるように、コードを移植可能にする必要があります。