C# FileStream WriteByte

Description

FileStream WriteByte Writes a byte to the current position in the file stream.

Syntax

FileStream.WriteByte has the following syntax.


public override void WriteByte(
  byte value
)

Parameters

FileStream.WriteByte has the following parameters.

  • value - A byte to write to the stream.

Returns

FileStream.WriteByte method returns

Example

The following code example shows how to write data to a file, byte by byte.


//from www  .  ja va 2 s .c  o  m
using System;
using System.IO;

class FStream
{
    static void Main()
    {
        const string fileName = "Test.dat";
        using(FileStream fileStream = new FileStream(fileName, FileMode.Create))
        {
           fileStream.WriteByte(123);
        }
    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter