Binary and Text File

AngeloAngelo Member Posts: 180
I just wanna ask simple question :
What is binary file? Can anyone show me how to implement it in Navision?binary file is used for what?
Please Advise......


  • Options
    pedroccdapedroccda Member Posts: 90
    [Non English text removed by Administrator]
  • Options
    CharlehCharleh Member Posts: 44
    Every file on your hard drive is made up of binary data, binary data is data comprising of just 2 symbols (01 also known as base 2) as opposed to decimal (0123456789 which is base 10).

    We use the decimal system to count from 1 to 10, but the same can be achieved in binary by using only 2 digits.

    bin | decimal
    00000001 - 1
    00000010 - 2
    00000011 - 3
    00000100 - 4
    00000101 - 5
    00000110 - 6
    00000111 - 7
    00001000 - 8
    00001001 - 9
    00001010 - 10

    It's much the same as decimal - just with 2 symbols instead of 10. This is the way computers store data, they work with 1s and 0s.

    You may have heard of bits/bytes - a byte comprises of 8 bits - a bit is either a 1 or 0. The maximum number you can represent with 1 byte is 255 in decimal (or FF in hexadecimal which is a base 16 numbering system, often used for specifying colours on the web) which is shown as 11111111 in binary.

    When you open a text file on your computer the program that you open it in (notepad maybe) reads this binary data and converts each byte/set of bytes into a character code (called ASCii or American Standard Code for Information Interchange). The program then shows you the binary data as a textual representation. Look at www.asciitable.com for a list of ascii codes (you can see every letter I type here is really converted into a number and stored in the mibuso.com database)

    Binary files are useful for storing data such as images and sounds, and maybe streaming in/out your BLOB data types from Navision (which are a binary data type).

    You may want to create your own file format to store some particular data, well you can do this in a binary file - then people can't read it easily. (This is not a method of security, it just helps keep things small and compact - you should by no means put sensitive data in a binary file and leave it unencrypted expecting people not to be able to read it)

    Look up the InStream and OutStream objects in your C/AL code reference manual for more information on streaming in and out to binary/text files.
Sign In or Register to comment.