Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:35 26 Nov 2024 Privacy Policy
Jump to

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: Australia
Posts: 265
Posted: 03:26am 14 Nov 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 1329
Posted: 09:30pm 14 Nov 2012
Copy link to clipboard 
Print this post

  James_From_Canb said  
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).
James[/Quote]

Hi James,
thanks for looking into this. I've always known I'm not a programmer's .....
but I just couldn't see what I was doing wrong! Mind you, having a pile of lyric text files of dubious genesis (that sounds good) to process doesn't help much!

GregEdited by paceman 2012-11-16
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6098
Posted: 11:59pm 14 Nov 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 265
Posted: 12:16am 15 Nov 2012
Copy link to clipboard 
Print this post

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: Thailand
Posts: 2209
Posted: 12:43am 15 Nov 2012
Copy link to clipboard 
Print this post

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


To reply to this topic, you need to log in.

© JAQ Software 2024