Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off LF/CRLF conversion in FatFS string functions #15

Closed
breakintoprogram opened this issue Feb 14, 2023 · 3 comments
Closed

Turn off LF/CRLF conversion in FatFS string functions #15

breakintoprogram opened this issue Feb 14, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@breakintoprogram
Copy link
Owner

breakintoprogram commented Feb 14, 2023

Raised by envenomator on Twitter:

If an 0x0D (\r) is written to a file, the byte 0x0A (\n) is also written.

@breakintoprogram breakintoprogram added the bug Something isn't working label Feb 14, 2023
@breakintoprogram
Copy link
Owner Author

The only conversion I can see is here.
Line 6500 of ff.c

if (FF_USE_STRFUNC == 2 && c == '\n') {	 /* LF -> CRLF conversion */
	putc_bfd(pb, '\r');
}

Setting FF_USE_STRFUNC to 1 in ffconf.h will turn off LF -> CRLF conversion

@envenomator
Copy link
Contributor

I always forget which one is which (CR/LF). Just tested with a small piece of code, writing to a file with fa_write | fa_create_always. As soon as I write a 0x0a, the 0x0D is immediately added as well. When I write a 0x0D, just 0x0D gets written, nothing extra.

@envenomator
Copy link
Contributor

Defined FF_USE_STRFUNC as 1 in ffconf.h and reflashed MOS 1.02; no additional 0x0Ds are added anymore, which is good. Also checked if saves/loads in BBCBASIC still work, which they do. So I think indeed setting this solves the issue; great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Released
Development

No branches or pull requests

2 participants