Author Topic: writing to text file produces extra spaces, and no line feed  (Read 1446 times)

Tags:
  • All members
  • Posts: 314
Hi,

I wrote a trigger today to test out a strategy I am working on.

Its pretty standard stuff, I lay at SP with max price = 1000, using a liability. Once the SP bet has been placed, the next action will log this into a text file.

After I inspected the text file, I was quite alarmed to discover that when MFP is writing the selections name into the file, there is a space for every character in the selections name. Also, the trigger is not adding in a carriage return

See image.

Is this a bug? If so, how can I get round this?

Thanks

Mark.

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Hello!

The file is in Unicode but originally was created as an Ansi file, hence the weird look of the letters in the file.

You need to delete it and let MF Pro create it anew.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 314
Hi Oxa,

Thanks for the reply. I have a selection file generator, which creates an empty file, and the selections file.

I will look to use

                if (File.Exists(paths.selFolder + @"SP\" + post))
                {
                    File.Delete(paths.selFolder + @"SP\" + post);
                }
                File.WriteAllText(paths.selFolder + @"SP\" + post, "", Encoding.Unicode);

which will create an empty unicode text file...

Interesting how I have used that code to write other files, and as you have indicated, it will by default create an ansi file, and I have not witnessed this before.

Thanks for letting me know. I appreciate that if there is no file there, MFP will create one on the first run, but that gives me a problem because I have wrote monitoring software, which means the presence of the file is essential..

Hopefully the above will solve the issue anyway. We shall see..

Thanks again

Mark.

 

Please note, BetFair is seems to be currently OFFLINE