dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

Māca citus, part 1.
Goto page Previous  1, 2, 3, 4
 
dev.gamez.lv Forum Index -> Programmēšana
View previous topic :: View next topic  
Author Message
BHC



Joined: 31 Jan 2006
Posts: 81

PostPosted: 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. Very Happy
_________________
Screenshot coming when hell freezes over.
Back to top
View user's profile
gazz



Joined: 03 Jan 2004
Posts: 355
Location: Teika

PostPosted: 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
View user's profile Send e-mail
Display posts from previous:   
dev.gamez.lv Forum Index -> Programmēšana All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
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