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):
Filename fn = GeGetPluginPath() + "consolelog.txt";
BaseFile *bf = BaseFile::Alloc();
if (!bf->Open(fn, FILEOPEN::WRITE, FILEDIALOG::NONE))
bf->WriteString("Start log regels."_s + "\n");
bf->WriteString("Einde log regels."_s + "\n");
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?
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++)
@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.
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!).