1 / 10

Files and Streams in C

Introduction. A File stores and maintains data called Persistent DataWhere a File is stored: second storage devices such as disks.When using a file, you need to load the file to computer memory.Create, upload and process data files in C

fidelina
Download Presentation

Files and Streams in C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Files and Streams in C#

    2. Introduction A File stores and maintains data called Persistent Data Where a File is stored: second storage devices such as disks. When using a file, you need to load the file to computer memory. Create, upload and process data files in C#

    3. Files and Streams The System.IO namespace includes stream classes such as StreamReader, StreamWriter and FileStream for file input and output. These stream classes inherit from abstract classes TextReader, TextWriter and Stream, respectively. Abstract class Stream provides functionality for representing streams as bytes. Classes FileStream, MemoryStream and BufferedStream (all from namespace System.IO) inherit from class Stream. Class FileStream can be used to write data to and read data from files.

    4. Methods Related to File The following lists several of class File’s static methods for manipulating and determining information about files.

    5. More Methods More Methods

    6. Directory Class Class Directory provides capabilities for manipulating directories.

    7. More Methods Related to Directory More static methods:

    8. File Operation Open and Close: they are used before/after you want to read, write, and modify the file. When open is called, the file is locked and loaded to memory and nobody else can access the file; When close is called, the lock is released and the file is also released from memory.

    9. How to Read File: Using StreamReader There are many ways you can read a file:

    10. How to Read File: Using FileStream There are many ways you can read a file:

More Related