I am trying to find an equivalent C# built-in function that does the same as the J# method available() which can be invoked on a BufferedInputStream object. The available() method is useful to detect the number of bytes available to a stream reader (such as in the case of a client/server socket connection)
Mazen
Lars-Inge T?nnessen - 27 Apr 2004 15:59 GMT
A C# file example. Let's say you have a file called "test.txt".
static void Main(string[] args)
{
System.IO.FileStream file = new System.IO.FileStream("test.txt",
System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.Console.WriteLine("Stream lenth: "+file.Length );
file.Close();
}
".Length" gets the length of a stream in bytes.
Regards,
Lars-Inge T?nnessen
www.larsinge.com