tailieunhanh - Lecture Object oriented programming - Lecture no 32

This chapter presents the following content: GUI overview, event-driven programming basics, GUI classes and packages, a simple window program, JFrame Class, Java components, JLabel component, JTextField Component, Component Listeners, interfaces, inner classes, anonymous inner classes, jbutton component, JOptionPane Dialog Box, distinguishing between multiple events, using GetActionCommand to distinguish between multiple events (optional), color. | CSC241: Object Oriented Programming Lecture No 32 Previous Lecture Stream and classes Input and Output stream iostream class ios class Formatting Flags Error-Status Bits Formatted File I/O Reading data Writing data Today’s Lecture File operations Formatted File I/O Reading data Writing data Character I/O Binary I/O Object I/O Character I/O put() and get() functions, can be used to output and input single characters These are member of ostream and istream, respectively Go to program Another way is to use rdbuf() function ifstream infile(“”); cout (buff), MAX*sizeof(int) ); ifstream is(“”, ios::binary); ( reinterpret_cast(buff), MAX*sizeof(int) ); reinterpret_cast operator It is used to make it possible for a buffer of type int to look to the read() and write() functions like a buffer of type char It changes the type of a section of memory Go to program Object I/O An object’s values can be written in and read back from a file Generally binary mode is use for Object I/O This writes the same bit configuration to disk that was stored in memory, and ensures that numerical data contained in objects is handled properly Example program Input value from user in an object of class person writes this object to the disk file Writing/reading an Object to Disk class person { protected: char name[40]; int .

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN