cancel
Showing results for 
Search instead for 
Did you mean: 

Loading from a Flat file: Binary and Text File

Former Member
0 Kudos

Hi,

Does anyone know what the difference is between loading from a binary file or text file?

Ramon

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

the difference is that text files contain lines (or records) of text and each of these has an end-of-line marker automatically appended to the end of it whenever you indicate that you have reached the end of a line.

So what happens when we read from a text file is that the end-of-line character for the operating system that we are using gets converted into a low value end-of-string indicator and when we write to a file the appropriate end-of-line character(s) get written when we indicate the end of the line. This makes the reading and writing of text files much easier because the appropriate end-of-line markers are handled for us.

With a binary file none of these conversions take place. When we read a binary file the end-of-line characters for our operating system will be read into the string and treated no different than any other character. When we write to a binary file the only end-of-line markers that are written will be those that we code into the output ourselves and hence will be exactly as we code it regardless of the operating system that we are running on. This makes it much easier for us when the file does not contain straight text and the end-of-line marker does not separate lines of text but rather appears as part of the non-text data content of the file.

Former Member
0 Kudos

Thanks Kaplana!

Can you give specific examples for the two types of files? Just so I may appreciate it better.

Ramon