Think wchar_t wird als 2 16bit int als UTF-16-Format gespeichert. Würde es nicht verwenden, außer du müsstest. Die folgende Struktur speichert jede Charta in einem einzelnen uint32_t (eine 32-Bit-Ganzzahl in C++). Aber wenn Sie einen unsigned long (64-Bit-Integer) Array benötigen, würde ich eines mit einem Vektor wie folgt erstellen:
std::vector<uint64_t> array;
für 32-Bit-Anschluss oder weniger
full file location:
https://github.com/NashBean/iBS_LIB/blob/master/iBS_Header.h
//-----------------------------------------------
//uchar = uint made to hold any char of the world
//-----------------------------------------------
struct uchar
{
uchar():value(0){};
uchar(int v):value((uint32_t)v){};
uchar(long v):value((uint32_t)v){};
uchar(uint32_t v):value(v){};
uchar(uint v):value(v.get()){};
uchar(char v):value((uint32_t)v){};
uchar(uchar const &v):value(v.value){};
uchar(wchar_t wch):value(decode(wch)){};
uchar& operator=(int unicode){
set((uint32_t)unicode);
return *this; };
uchar& operator=(uint32_t unicode){ set(unicode);
return *this; };
uchar& operator=(uint unicode) { set(unicode.get());
return *this; };
uchar& operator=(char ch) { set((uint32_t)ch); return *this; };
uchar& operator=(uchar uch) { set(uch.get()); return *this; };
uchar& operator=(wchar_t wch) { set(decode(wch).get());
return *this; };// use of Uchar.h
bool operator==(int i) { return (value == i); };
bool operator==(uint32_t unicode) { return (value == unicode); };
bool operator==(uint unicode) { return (value == unicode); };
bool operator==(char c) { return (value == c); };
bool operator==(uchar uch) { return (value == uch.value); };
uint32_t get() { return value.get(); };
void set(uint32_t v) { value = v; };
private:
uint value;
};
Was ist der Wert von 'wszFormat'? Ich würde "% lu" erwarten. – chux
Danke .. das war der Fehler. Ich habe% d verwendet. – Sana