Set the code page of the project the name of the library classes to create a binary file. The names of the library classes is "IO" names, which are used to read and write files. For example, at the beginning of lines of code insert the following line: Include System IO.
Create a file stream, then set the variable to a binary value. This will create a bin file but it is empty. The binary file can be created with any extension, but most often use the. bin extension. To create a binary file, use the following code:
FileStream file = new
FileStream(“C:\\mybinaryfile.bin”, FileMode, Create)
BinaryWriter binarystream = new
Write in code the function to write the binary file. To do this, use the Write command. This feature automatically generates the coding values in binary mode, which will save you from re-encoding before you save the file. Example of a record in binary file: "binarystream Write ("My first binary file"); binarystream Write (10);"
Close the file after it is saved all the necessary information. Note that closing a file in programming is extremely important process because it means the end of the file creation process. Only after the file is closed, it becomes available for use by applications. To close a binary file and save it on disk, put that in the code the following expression: "binarystream.Close();".
Test the generated binary file. To do this, run the application, information which contains the generated file. If all the underlying functions are executed, the software code is written correctly. Otherwise you will have to recheck the entered code, and the information placed in the file. Use the debug binary of the file and test again.