Please enable JavaScript.
Coggle requires JavaScript to display documents.
Data Structure Vs File Structure, Basic Operations on File, Fragmentation,…
-
Basic Operations on File
Closing a file
-
Better to close the file manually to prevent any data loss in case the program doesn't terminate normally while doing operations on the file.
Reading from file
-
-
Reading to binary object
file.read((char*)&object, sizeof(object))
Signature
istream& read (char* s, streamsize n);
-
Writing on file
-
-
-
Signature
ostream& write (char* s, streamsize n)
-
-
-
Opening a file
-
Once a file is opened, the file pointer (eg. .tellg()) is positioned at the beginning of the file
fstream file(filename, filemodes)
alternative syntax: file.open(filename, filemodes)
-
Fragmentation
-
-
External Fragmentation can be compacted, which means combine
-
-
-
-
-
-
-
-