Reading text file with correct text encoding mode

I can read from text file using this code but i'm unabled to read Turkish or other non-English codes, how can i read non-English chars and set the default encoder parameter as if it's working fine in Windows Notepad's ...

Posted On: Sunday 25th of November 2012 09:51:58 PM Total Views:  440
View Complete with Replies

Related Messages:

winsock2 & wxWidgets: application hangs after reading UDP datagram,then accessing wxTextCtrl   (208 Views) wrote: > wxWidgets and sockets are OT in this newsgroup. That is a matter of perspective, especially when the bug is somewhere in between and might also involve boost::thread usage. However, a fullquote followed by a single line of a useless "smart" remark is always OT. .... Lars
Earning for reading SMS   (175 Views)
I found few genuine sites for earning through your mobile. 1) 2) Earning Highlights: = Earning for receiving SMS in your Mobile. = Earning for receiving SMS by your network upto three levels. = Earning for every member you created under your network. = Free SMS sending options. Visit and calculate how much can you make through SMS or Email. HAPPY MOBILE EARNING.
while(!FP.eof()) is reading the last data point of the file twice   (172 Views)
I'm wondering if someone could point me to the flaw in the following code that uses the while(!FP.eof()) condition to read the input data. This condition is reading the last data point of the file twice. #include #include using namespace std; int main(int argc, char **argv) { double x; ifstream FP("test.d"); //while(!FP.eof()){FP >> x; cout x){cout
Problem reading a bin file   (176 Views)
I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features to an old program that I wrote in delphi and it's a good opportunity to start with c++. well, the problem is: I need to read a binary file according to some structure, all variables of its structure are of type "char" of different sizes. The reading is made ok, but the value that I got of ManVer is his value concatenated with Pieces and Weight and WeightUnit, the value of Pieces is his value and also concatenated with Weight and WeightUnit. This happens with the rest of variables until the last of them, that only has his value. Only when I see the structure with Evaluate/Modify (Ctrl +F7 on windows) the result is the one that I expect to get I hope that you can help me... here's the code: -------------- ifstream _fileStream; TStructure_V250_Data _buffer250; //open the file... char* _fName = new char[_fileName.Length() +1]; strcpy(_fName, _fileName.c_str());, ios::binary); delete [] _fName; //read data...*)&_buffer250, sizeof(_buffer250)); --------------------------- _buffer250 structure is too long, i only show you a piece --------------------------- typedef struct _Structure_V250_Data { char ManVer[4]; char Pieces[3]; char Weight[5]; char WeightUnit[2]; //... //... //... } TStructure_V250_Data;
Strange problem reading unsigned chars from an ifstream   (251 Views)
Hi , Sorry if I'm just being daft, but I can't immediately see why the following code won't work. It's supposd to read in the characters from blah.raw one by one, then output the textual representation of them to blah.txt, with spaces between each. The end result is almost right, but it arbitrarily misses out a couple of values. Please could you tell me if I'm doing something obviously wrong (Or...failing that, might I have a minor bug in my library implementation I'm assuming it's my own fault for the moment, but it has crossed my mind...) Cheers, Stu (I'm trying to do this as a quick(!) way of getting a heightmap into MATLAB to render a surface rather than writing a heightmap viewer in OpenGL, for what it's worth, and it's missing one pixel value each on the first and last lines.) #include int main() { std::ifstream ifs("blah.raw", std::ios::binary); std:fstream ofs("blah.txt"); unsigned char c; while(ifs >> c) { ofs
reading variables from a stream(beginner)   (172 Views)
hello, what i am trying to do is set up a loop that grabs multiple variables from an input file. my question is, is there a built in function in the istream class that can grab multiple values on one line. such as 60 40 10 10 all getting put into different variables. the problem i am having is that there is other data in the file that i do not want to do this to. can i set the get for only the first line of data from the file.
File reading problem   (172 Views)
Hi! I have a program with a class that needs to be able to write itself to a file in clear text format. The file has two integers and vector of struct objects. The struct has a string that can consist of one or more words and a few integers. I'm able to create the file properly, as confimed by viewing it in a text editor, but something goes wrong when I tried to read it. I've made a test program illustrating the problem: #include #include #include #include using namespace std; struct s_t { s_t() {} s_t(const string& si, int xi, int yi) : s(si), x(xi), y(yi) {} string s; int x, y; friend ostream& operator(istream& is, s_t& rhs); }; ostream& operator> x >> y; { s_t temp; while (in >> temp) vec.push_back(temp); } in.close(); cout
Problems with file reading and writing   (166 Views)
, I've encountered a strange problem which I can't seem to explain. I've written a simple C++ class that deals with a certian binary file. In one of the methods there, I wish to update a file - namely to read a certain field whose offset I know, and then write to another field, whose offset I also know. In order to read the data, I first use file.seekg(offset, ios::beg), and then a read command; I've checked the variable, and this part is executed as it should be. The problem is with the writing. To place the head where I want it, I use a file.seekp(offset, ios::beg) statement. After this statement, regardless of what the value of 'offset' is, file.tellp() always returns '-1'. The file was opened using the statement:, ios::in | ios:ut | ios::binary) where FileName is a string. The reading goes smoothly and returns the correct values, so I doubt there's a problem with the actual opening of the file.
Re: reading a string at the end of a line   (171 Views)
Thank you, all of you have been very very helpful in this and i am very apprciated.. Now i have what i need, but it seems the program will not rename the extension and refuses to. heres the code I have: #include #include #include using namespace std; int main(){ ifstream fin; string fname,fdefault="BmpData.txt"; cout
reading in comma delimited file into array   (176 Views)
hi- I want to read in a text file that is comma delimited with floating point values. I'm confused whether ifstream or fopen is the correct format to use for this. if I use ifstream, how to I read in one line at a time into the array also is there a way to get the total number of lines in the text file so I know how big to set the array the text file looks like 1.555,2.555 1.948,33.44 etc, and I just want to put the values in an array with two columns. it sounds pretty simple but I haven't been able to figure out how to do it yet. so far the code is ifstream input("data_record.txt") if ({ cout
multithreading with each thread in a separate class instance vs. in aC-style kernel thread calls in C++   (205 Views)
Other than looking cleaner in the object oriented approach (each thread's main function in one class) vs. having UINT _ _stdcall ChildThread (void *args) {...} required declarations for Windows kernel calls, I'm not sure about the advantages of the first ...
Implementing the NeXus(format) reading Library NCL   (180 Views)
I am trying to add the ability to read the NeXus file format to my program, I found a library called NCL which does this. My problem is that all my experience is in in Delphi so my C++ is ...
Boost serialization: Problem reading strings from binary archive   (160 Views)
, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as ...
Simple multi-threading   (148 Views)
Currently I have a single threaded server, developed using C, serving multiple client at the same time, now I want a new feature: a. I need to execute a particular program at some point, e.g. email.exe b. the email.exe might ...
Need suggestions for: C++ IDE and threading/GUI libraries.   (134 Views)
A little background first. I've done a bit of C++ programming in the past, but then fell in love with the ease of multithreaded and GUI programming in Java. I've been using Java for a long time now and have ...
Problem reading wstring from a wstream   (162 Views)
Compare these two programs: int main() { const wchar_t str[] = { 0xFEFF, 0x2EE4, 0x0000 }; wstringstream ss( str ); wstring line; getline( ss, line ); assert( line.size() == 2 ); assert( line[0] == 0xFFFE ); assert( line[1] == 0xE42E ...
May I have a example of design pattern of "composite", I still feel fuzzy after reading book of Addison-Wesley's"design pattern "   (146 Views)
Thank you for your kind & help !...
reading string from char array   (140 Views)
I have a programs that reads char ouput and should send a signal when it reads "login". I am currently reading into a char array but how do I check for the match I don't think I can do- ...
multithreading.   (143 Views)
hello evreyone , when i last posted to ask you people to suggest me where to begin from for multithreading in c++ a lot many good people suggested me to begin with a good book . the only one of ...
bazillion stepstones with multithreading...   (173 Views)
<- about to have a major crisis here. I wanted is to create a little tool with a GUI. Now I see problems related to thread programming arising everywhere. If I use the GUI to set a flag as ...