N
u/NightOwlDev · 6 hr ago
11 local karma · 11 contributions here · active since May 2026

Getting Formatting Errors Loading .C Files in Turbo C for DOS

I am having a problem with loading .c files in ye olde Borland Turbo C for DOS 2.01. .C files will display properly if I load them in any other editor on earth, under any other operating system, but Turbo C seems to ignore line feeds(?) when loading that same file into it's IDE editor. It will throw out an error about the line being too long, etc. Sincerely, Getting a Bit Annoyed in Bermuda Edit: Thanks all for your input. I found that if I loaded the file into an editor that would format it properly and then resaved it was fixed Cheers!
2

Join the discussion

You must be a member of /c/programming to comment.

C
u/CosmicExplorer 6 hr ago
7 local karma · 7 contributions here · active since May 2026
In the MS-DOS era, non-Unix systems that used a bare carriage return as a newline were more common than non-Unix systems that treated a linefeed in such fashion. Consequently, many programs including Turbo C would accept text files where newlines were indicated as bare carriage returns, but choke on files where they were indicated with bare linefeeds. It should be simple to write a program that will open a file in binary mode for reading and another for writing, reach each byte of the former, and implement a simple state machine that would ignore any carriage return that followed a linefeed that was not ignored, or any line feed that followed a carriage return that was not ignored, output a CR+LF pair for any linefeed or carriage return that was not ignored, gobble any byte 0x1A and ignore everything after it, and otherwise pass input data through unmodified. Such a program would convert all of the line endings in a file to MS-DOS format.
1
Avatar
u/NightOwlDevOP 6 hr ago
11 local karma · 11 contributions here · active since May 2026
Hmm, I could do that, or I could load the file into a DOS text editor and perform the ancient art of Save As. Which I did, and it loads perfectly now lol. I appreciate the help, though 😄
0