SOLVED Null characters in txt file (ascii - utf?)

I have a command plugin that sends the console output to a txt file.
However, there are - at the beginning of each line - strange (Null characters).

For example (I use Notepad++ to look at the output text file):

0_1538389006030_ascii-nul.JPG

Filename fn = GeGetPluginPath() + "consolelog.txt";
BaseFile *bf = BaseFile::Alloc();
if (!bf->Open(fn, FILEOPEN::WRITE, FILEDIALOG::NONE))
	return false;
bf->WriteString("Start log regels."_s + "\n");
...
bf->WriteString("Einde log regels."_s + "\n");
bf->Close();
BaseFile::Free(bf);

I think it has something to do with ascii versus utf?

What can I do to get rid of these non ascii characters and just have plain ascii characters in my text file?

-Pim

Ok, what I detected is that WriteString() inserts characters before the string.
If I use WriteChar(outString[i]), it is ok.

The question remain, why does WriteString add characters?

for (i = 0; i < outString.GetLength(); i++)
{
	fn->WriteChar(outString[i]);
}

Hi Pim,

@mp5gosu already gave the link to the relevant manual in our docs.
BaseFile and HyperFile classes store additional datatype information to a file. To avoid this you need to use the direct byte access, mp5gosu linked to.

Bye,
Andreas

By the way, I left the link uncommented intentionally, as all what is written there would have been a simple copy/paste. 🙂

@mp5gosu Sorry, I didn't want to lower the efficiency of this thread. We really appreciate your contributions. Just sometimes I feel the urge to add a few more words for future readers. It's not my intention to lower the value of your contribution (I also up-voted your post). I hope you don't mind.

@a_block sure, will keep it in mind for future posts - you're absolutely right!

Thanks very much.

(There is so much information to be read!).

-Pim