TAILIEUCHUNG - Lecture Introduction to computer and programming - Lecture No 27

The contents of this chapter include all of the following: Describe equality testing, show how to override Object Equals (error checking, casting, chaining to base class, comparing data), present static helper method. | CSC103: Introduction to Computer and Programming Lecture No 27 Previous lecture Example program – structure C preprocessor directives Macro expansion File inclusion Conditional Compilation Today’s lecture outline Introduction to File File operations Reading from file (character by character) Writing in file (character by character) File Until now we have been saving record in volatile memory . RAM . entering books record, display and search facility (struct book) File can be used to store data permanently . on hard disk Data in files can be retrieve even the computer is powered off C programmer is able to read, write, modify and delete the content of file Cont. A common data file hierarchy is typically broken down into five categories Bit Binary : digit, 0 or 1 Byte : Eight bits Field : Grouping of bytes Record : Grouping of fields File : Grouping of records Fields, Records Fields could be a name, cgpa, department, street address, phone number, and so on Records are logical groupings of fields that comprise a single row of information A student record might be comprised of name, age, ID, and GPA fields. Each field is unique in description but together describes a single record. Name ID CGPA Department Ali Ahmad 105 Computer science Fahad Hamid 109 Computer science Field Record Data file Data files are comprised of one or more records Files can be used to store all types of information, such as student or employee data C programmers use pointers to manage file for reading and writing data Fatima Tariq 102 Physics Ali Ahmad 105 Computer science Fahad Hamid 109 Computer science File Operations Creation of a new file Opening an existing file Reading from a file Writing to a file Moving to a specific location in a file (seeking) Closing a file Example program Go to program Opening a File Before reading and writing operation on file, file must be opened fopen() function can be used to open a file Example program opens ”” file in .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.