File Stream
-------------------
static void Main( string[] args )
{
Console.WriteLine( "hellow" );
Stream s = new FileStream( "test.txt" , FileMode.Create );
Console.WriteLine( s.CanRead );
Console.WriteLine( s.CanWrite );
Console.WriteLine( s.CanSeek );
int temp = 6;
byte[] temp2 = BitConverter.GetBytes(temp);
Console.WriteLine( "temp2 length :" + temp2.Length.ToString() );
s.Write( temp2 , 0 , temp2.Length );
s.WriteByte( 102 );
byte[] block = { 1,2,3,4,5,};
s.Write( block , 0 , block.Length );
Console.WriteLine( s.Length );
Console.WriteLine( s.Position );
s.Position = 0;
Console.WriteLine( "ReadByte1 : " + s.ReadByte() );
Console.WriteLine( "ReadByte2 : " + s.ReadByte() );
Console.WriteLine( s.Read( block , 0 , block.Length ) );
s.Close();
Console.ReadLine();
}
-----------------
댓글 없음:
댓글 쓰기