I have the following problem- there is a file with information (I don't know the size of the file) like this:
\0\0\0\0\0\0123456789\0\0\0\0\0\0Name
\0\0\0\0\0\0111111111\0\0\0\0\0\0Name1
\0\0\0\0\0\0222222222\0\0\0\0\0\0Name2
and my goal is to read the numbers in the middle and the name at the end of the lines. I'm trying to read line by line using string like this:
std::ifstream fileStream(file, std::ios::binary);
if (fileStream.is_open())
{
string line;
while (getline(fileStream, line))
{
cout << line;
}
}
but my output is : nothing
>
>
>
I guess that is because there are null characters in there and the string is terminated when the first null character is met, so that's why there is no output. I just don't know how to read the whole thing and then trim the null characters.
Any help would be appreciated.