|
dev.gamez.lv Latvian Game Developers Community
|
View previous topic :: View next topic |
Author |
Message |
BHC
Joined: 31 Jan 2006 Posts: 81
|
Posted: Tue Mar 28, 2006 11:54 pm Post subject: |
|
GazZ wrote: | vienkaarshs standalone piemeers:
Code: | #include <string>
#include <sstream>
#include <fstream>
unsigned short bladaac = 15;
using namespace std;
void main() {
wofstream file("test.txt");
wostringstream outStream;
outStream << L"bladāņīc, " << bladaac << ends;
file << outStream.str();
file.close();
} |
test.txt fails satur tikai un vieniigi "blad"
PS - ja iznjem aaraa tos LV burtus, tad var redzeet arii ka unsigned short netiek normaali izvadiits. |
Tas pats ir, ja izmanto parastos 8bit stringus, kur elements ir char.
std::ostringstream os;
char a = 42;
os << "Kaut kas: " << a; // Būs simbols nevis skaitlis
os << "Kaut kas:" << (short)a; // Būs skaitlis
Tavā gadījumā stringa elements ir unsigned short.
Un notiek pilnīgi tas pats.
Taisi typecastu.
PS. Neesmu strādājis ar "platajiem" stringiem. _________________ Screenshot coming when hell freezes over. |
|
Back to top |
|
|
gazz
Joined: 03 Jan 2004 Posts: 355 Location: Teika
|
Posted: Wed Mar 29, 2006 6:03 pm Post subject: |
|
shkiet atradu probleemas ceeloni. sourchu faili ir ar ANSI encodingu un ja es defineeju stringu ar ANSI encodingu ieksh shii faila un to meegjinu uzstaadiit wstring kas ir ar UNICODE encodingu - fonaa shis teksta srings netiek konverteets. attieciigi āēūž un citu lv burtu ANSI kodi noziimee pavisam ko citu UNICODE encodingaa, kas arii noved pie taa ka streami tiek nogalinaati, jo tiem tiek vadiiti kaut kaadi ?sisteemas?(taa ir?) kodi. Ielasot teksta stringus no UTF-8 faila shiis probleemas pazuud. Secinaajums - tev nebuus rakstiit UTF-8 log failu ar latvieshu burtiem |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|