std::wifstream is the C++ standard library type for reading wide characters from files.
Questions tagged [wifstream]
27 questions
1
vote
2 answers
how to get a single character from UTF-8 encoded URDU string written in a file?
i am working on Urdu Hindi translation/transliteration. my objective is to translate an Urdu sentence into Hindi and vice versa, i am using visual c++ 2010 software with c++ language. i have written an Urdu sentence in a text file saved as UTF-8…

saqib maqbool
- 37
- 2
- 5
1
vote
3 answers
How to write and read UTF16 file on Win using C++
There is a plenty of questions on SO regarding this, but most of them do not mention writing wstring back to file.
So for example I found this for reading:
// open as a byte stream
std::wifstream fin("/testutf16.txt", std::ios::binary);
// apply…

NoSenseEtAl
- 28,205
- 28
- 128
- 277
0
votes
0 answers
Issues with the templates, when I use a wstring and a wchar_t
I've written a function that turns a string into a vector. Now I want to make a template of the types, because I also want to use wstrings and wchar_t. Because they are in a csv file. Here are my files ...
main.cpp
#include
#include…

BSlegt
- 11
- 1
0
votes
1 answer
Failing to find a wchar_t that is present in a std::wstring
I was playing with std::wstring and std::wfstream, when I encountered a strange behaviour. Namely, it appears that std::basic_string::find fails to find certain characters. Consider the following code:
int main()
{
std::wifstream…

Fureeish
- 12,533
- 4
- 32
- 62
0
votes
2 answers
wstring read from .txt file doesn't print properly, but when written back to a file it's fine
I'm reading a wstring from .txt file using a while !eof loop:
std::wifstream fileStream(path);
std::wstring input;
while (fileStream.eof() == false) {
getline(fileStream, input);
text += input + L'\n';
}
But when i print it in wcout some…

G_glop
- 63
- 1
- 8
0
votes
1 answer
Using GetLine with ifstream - no instance of "getline" matches the argument list
I am trying to figure this problem out, for some reason I keep getting this:
no instance of "getline" matches the argument list.
I have looked up this problem and a lot of times its because people use ofstream, or they don't use the ifstream…

Trevin Corkery
- 45
- 10
0
votes
3 answers
c++ writing and reading text file is very slow, any alternatives?
I am currently writing code for a game and I'm a little bit stuck on saving and loading the level. For writing I use this piece of code:
bool WorldGen::GenerateNewWorld(unsigned int seed, int width)
{
std::cout << "World generating..." <<…

Jannes D.
- 65
- 6
0
votes
0 answers
std::wstring (from wifstream), spec. chars
I need a std::wstring, from a std::wifstream, as the wifstream contains, special characters, such as:
ä,ê
and, so on.
I have a code
wifstream *inFile = new wifstream(szFile);
std::wstring…

hansa
- 139
- 2
- 13
0
votes
1 answer
Writing class object to file using streams
I have this code to serialize/deserialize class objects to file, and it seems to work.
However, I have two questions.
What if instead two wstring's (as I have now) I want to have one wstring and one string member
variable in my class? (I think in…

pseudonym_127
- 357
- 7
- 16
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
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
-1
votes
1 answer
How do I widen a char in c++
I'm writing a game in c++ using SFML, I found a font that support French characters. However, in the program I read all the text from files to be able to support different languages, but I don't know how to extract the text without errors into a…

Ingy
- 1