Questions tagged [wofstream]

The C++ standard library type std::wofstream is a specialized std::wostream which uses a std::wfilebuf to write wide chars or wide strings to a file.

This is C++ std file output stream for data which has wide characters.

70 questions
0
votes
0 answers

C++ doesn't save UTF-8 encode file

I'm working in a software that need to save a utf-8 file with special characters (like 'çäüëé'). I received the content to save (regular string with special characters encoded) from a webservice (with gsoap). When I try to save, using ofstream, the…
Felipe Reis
  • 41
  • 1
  • 7
0
votes
1 answer

Write encrypted wstring to wofstream

I have a simple "encryption" function that works with wstring variables and I want to write the result of this function into a file, using wofstream. This is my code: void save_file() { wstring text = L"Text to be encrypted. The text is…
ali
  • 10,927
  • 20
  • 89
  • 138
0
votes
0 answers

What encoding is used for file when writing by `wofstream`?

I'm using mostly wstring and wide characters in my application. I'm saving data to files using ofstream and large amount of conversions in my code. I need my save files to be easily editable by hand, therefore I'd like to keep current file…
kravemir
  • 10,636
  • 17
  • 64
  • 111
0
votes
2 answers

C++ Unicode Issue

I'm having a bit of trouble with handling unicode conversions. The following code outputs this into my text file. HELLO??O std::string test = "HELLO"; std::string output; int len = WideCharToMultiByte(CP_OEMCP, 0, (LPCWSTR)test.c_str(), -1, NULL,…
jacobsgriffith
  • 1,448
  • 13
  • 18
0
votes
1 answer

Reading random access files

I have developed a C++ application for reading and writing data on a random access file. (I use Visual C++ 2010) Here is my program: #include #include #include using namespace std; class A { public : int a; …
Arashdn
  • 691
  • 3
  • 11
  • 25
0
votes
1 answer

Why does redirecting wcout/wcerr to /dev/null cause program to crash?

consider my logging class void LogWriter::InitLogWriter(void) { wcout.flush(); wcerr.flush(); COUT_BACKUP = wcout.rdbuf(); // save original cout buffer CERR_BACKUP = wcerr.rdbuf(); //save original cerr buffer FileStreamOpen =…
Robert Snyder
  • 2,399
  • 4
  • 33
  • 65
0
votes
1 answer

iostream, wifstream, and eclipse/g++ on windows

I am using Eclipse on windows with the MinGW tool chain (g++, etc.). I have a program that I built on darwin that reads and writes to files using wifstream and wofstream. The program comiles and works find using eclipse on darwin (Mac)...no for my…
Cryptik
  • 53
  • 2
  • 8
0
votes
2 answers

Synchronization output streams from different threads

I'm writing an app that writes to xml file some data from different threads. I try to synchronized it using Event core object, but in file I get wrong data. I get next result
abilash
  • 897
  • 3
  • 12
  • 32
0
votes
1 answer

Output to string instead of wofstream

For the following code, is it possible to output the result to a string instead of wofstream? Thanks you! wstring w = L"test"; std::wofstream ofs("test.txt"); std::locale utf8_locale(std::locale(), new…
echo
  • 789
  • 2
  • 12
  • 21
0
votes
2 answers

Can't write wstring with Russian characters to file

I'm trying to write wstrings (in Russian) in Linux, in C++ code in the following code: ofstream outWFile; outWFile.open("input.tab"); outWFile<< WStringToString(w->get_form()); outWFile<<"\t"; outWFile<get_tag()); std::string…
rok
  • 9,403
  • 17
  • 70
  • 126
1 2 3 4
5