- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use C# FileStream class?
A stream for file operations such as read and write is provided by the FileStream class.
Create an object like this
FileStream fstream = new FileStream("d:\
ew.txt", FileMode.OpenOrCreate);
Above we have used FileMode.OpenOrCreate so that the file or opened or created if it does not already exist.
The following is n example showing how to use the FileStream class in C# −
using System; using System.IO; public class Demo { public static void Main(string[] args) { FileStream fstream = new FileStream("d:\
ew.txt", FileMode.OpenOrCreate); // write into the file fstream.WriteByte(90); // close the file fstream.Close(); } }
- Related Articles
- How to use C# BinaryReader class?
- How to use C# BinaryWriter class?
- How to use Stack class in C#?
- How to use Queue class in C#?
- How to use ArrayList class in C#?
- How to use NameValueCollection class in C#?
- How to use the directory class in C#?
- What is Google drive filestream?
- How to use WriteLine() method of Console class in C#?
- How to use ReadKey() method of Console class in C#?
- How to use the Clear method of array class in C#?
- How to use the Clone() method of array class in C#?
- How to use the Copy(, ,) method of array class in C#
- How to use the CopyTo(,) method of array class in C#
- How to use the GetLength method of array class in C#?

Advertisements