Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Bug in DOS MMBasic - print statement
Author | Message | ||||
James_From_Canb Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 265 |
Hi. There is a bug in DOS MMBasic 4.0. It isn't printing correctly to a file. Instead of appending a CRLF (0D0A hex) to the end of each line, it's appending a CRCRLF (0D0D0A hex). 2012-11-14_132513_ShowPrintBug.zip The zip file contains code that demonstrates the bug and an input file of text with normal CRLFs between lines. It's copied to the file OUTPUT.TXT. Open the file in a hex editor to see the problem. Is this the right place to report bugs? I tried reporting a previous DOS MMBasic error on Maximite.com.au, but I can't find it there. Regards James PS there may be another bug where a delay is required before accessing an opened file, but I'll research it a bit more before I raise the issue. My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention. Hedley Lamarr, Blazing Saddles (1974) |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
|
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
What I thing is happening is, when a LF is printed, the system adds a CR. You can get around it by changing your demo program to lf$=chr$(10) Open "test.txt" for input as #1 Open "Output.txt" for output as #2 Print #2, "Just to show it's not related to the input file";lf$; Do Line Input #1, lyricLine$ print #2, lyricLine$;lf$; ' just copy it to another file Loop Until EOF(#1) Close #1, #2 END We suppress the CRLF pair and substitute a singe LF for each line. Not a permanent fix, but it might help. I expect the problem comes about by the need to use different compilers for the different systems. Jim VK7JH MMedit MMBasic Help |
||||
James_From_Canb Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 265 |
That's an EXCELLENT workaround Jim. Many thanks James My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention. Hedley Lamarr, Blazing Saddles (1974) |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
it is caused by the different environments. In C# they solved it with a System.Environment.NewLine. Maybe something that can be done with a #define in C too. Microblocks. Build with logic. |
||||
Print this page |