C++

Objectives :

  • myfstream_binaries1.cpp
    creating a binary file and write data into the file using a class object
    Note: In this example the public members were not used, but required to create a class object.
  • fstream
    • osream.write()--member function function
    • istream.read(ch1, 100);
  • Code: myfstream_binaries1.txt
  • This example is completed in a series of two web-documents.
    myfstream_binaries2.htm
  • A similar example with text file is shown here: myifstream_get1.htm
 

Step: 1 Create a source file.

Note there was no "empdata.dat",  file

Step: 2 Edit and save Source file

Step: 3 Runtime Views: Prints first member of the class object.

Note the text , but the primitive variable, double data object was not readable.

Step: